« first day (1586 days earlier)      last day (3365 days later) » 

3:00 PM
I have a feeling all this advice will be for naught when you come back in an hour asking, "Ok, now how do I do it when the player can double down?"
 
I am not implementing that for now
 
then I am not gambling in your casino :(
 
There are no bets either
 
Here's a simple (but ugly) way to do that last line :
winner = max((player_score, self.player), (dealer_score, self.dealer))[1]
 
gross
 
3:01 PM
I don't think that would work
 
it will
 
What about when the scores are tied? Who wins?
 
self.player cannot be maxed
@Kevin oops
 
Wouldn't it compare by the memory address of the player and dealer objects?
 
In a tie, the dealer would win
 
3:03 PM
@PM2Ring Ffisegydd linked it in the question (and actually voted for dupe-close but it didn’t go through)
 
In [2]: max((10, "foo"), (20, "bar"))[1]
Out[2]: 'bar'
seems legit
 
Are self.player and self.dealer objects? Like Player objects? If so, do you have self.player.score?
 
You'd have to do like max((player_score, 0, self.player), (dealer_score, 1, self.dealer))[2] to specify player precedence
 
@Ffisegydd Yes they are object
 
Cos if so then you could do max(self.player, self.dealer, key=lambda x: x.score) or something?
 
3:04 PM
I get their score via
self.player.caclulate_hand_points()
 
@Kevin Yes, if there were a tie then using my code the id's of self.player and self.dealer would be compared, and generally id is machine address (but it doesn't have to be).
 
You could implement the comparison operators for players so that player_a > player_b returns true iff A's score is higher than B's. Then you can just do return max(player, dealer) in the final else block.
 
I already added a block for the tie
 
In which case do max(self.player, self.dealer, key=lambda x: x.calculate_hand_points())
 
@MarkR. Well, I did say it's ugly. But without knowing the attributes of the class it's the best I could do on the spur of the moment. :)
 
3:06 PM
@Ffisegydd I think that is too much stuff jammed into one line
 
still gross :)
 
(My last message is assuming that each player object knows whether it's a dealer. Otherwise, they won't know how to negotiate tied scores)
 
Yes
 
I prefer readable > fancy in most cases
 
Dealer has it's own class
 
3:07 PM
@Vader fair enough, that's how I'd do it anyway (actually I'd probably have a Player().score property so it's not a function but an attribute but yeah).
 
in Dealer:

def get_winners(self, players):
return [player for player in players if self.score < player.score]

(although it should be in the game class, not in the dealer class)
 
@Vader side question: have you made Dealer inherit from Player?
 
Yes
It overrides a few methods though
 
Good :D
 
I think we've spent 20 times more lines discussing this issue, than the number of lines Vader would save by replacing his existing working code with a one liner.
 
3:08 PM
Its not about saving lines per se, more like what's a good way to solve this problem
@MarkR. Interesting
That is what I was looking for actually
 
I prefer my solution personally whistles :P
 
@poke Ah ok. I assumed that was the intended dupe, but I just wanted to check before voting.
 
@poke I've voted to re-open it.
 
@MarkR. would you say that your method is a hack?
 
it wasn't mine
 
but not really a hack, just a slightly fancy way of doing things (with potential side-effects, too)
 
I'd say Ffisegydd's max suggestion is less hacky
 
Oh right, srry @PM2Ring ;)
 
re. the openvote-plz: we ideally want to re-close as a dupe if someone has a hammer ready.
 
@Ffisegydd Yeah, I’m just waiting for it to become open again
 
3:13 PM
also, it's , that gets picked up by the extension
 
Well the one @PM2Ring suggested is easy to follow for me.
 
I originally voted as OT because back then, it wasn’t clear yet. But after talking to OP, the dupe was relevant
 
Ok, voted
(to reopen)
 
derp, I can’t vote…
@Jon You around?
 
Okay it's open (and @poke yeah that's why I asked for someone with a hammer :P)
 
3:15 PM
@MartijnPieters You around?
@Ffisegydd Sorry >_<
 
Kevin should be able to (if he agrees of course)
 
@Vader My method is certainly a bit hacky. I actually prefer fizzy's method, but mine works without knowing about the attributes or methods of the classes... assuming it doesn't have to handle ties. :)
 
@Ffisegydd Just gotta read the question and answer and proposed target first.
 
@Kevin See the comment to my answer for the relevant part
 
Don't be silly. Trust everything I say. If you VtC you can have your Starlord title back.
 
3:16 PM
I guess I should looks at both
 
Ok, looks good to me.
 
Thanks Kevin
You cleaned up the mess.
 
Hooray, I accomplished something.
 
@poke: sorta-kinda
 
Already solved it without you, but thanks :)
 
3:23 PM
@poke \o/
See what powers I have?
 
Amazing.
 
On Saturday evening I felt motivated to work on KS. I wanted to determine whether the motivation would roll over into Sunday if I didn't do anything until then. Theoretically, it might be better to have 10 motivation points on Sunday, then to have 5 points on Saturday and 5 points on Sunday.
Result of experiment: points do not roll over between days.
 
I could have told you that.
 
This is a problem. If I only generate 5 motivation points per day, and they expire when I go to sleep, I won't ever be able to do anything that costs six or more points.
 
you could sleep twice a day
 
3:26 PM
^^ innovation
 
I would if I could :-)
 
When are motivation points refreshed though? When you wake up? Or when the watch strikes 0000?
 
When he generates 88 jigawatts
 
I actually do tend towards biphasic sleep when I have no schedule constraints. 5-6 hours starting at midnight, and 2-3 starting at 2:00 PM
@Ffisegydd When I wake up. It's Groundhog Day rules.
 
you should dream of sleeping, maybe that'll generate more points. Just make sure you keep a spinner with you.
 
3:28 PM
Awww man I was gonna go for an Inception joke :( I got DSM'd by Reut ;_;
 
I googled how "dreidel" is commonly called
 
How can we help this guy? stackoverflow.com/questions/28587026/… It looks like the module he's using is borked.
 
Which means you were slow :D
 
I can get more points in extraordinary circumstances, ex. If one threatens to destroy a cherished childhood possession of mine.
So all I need to do is get a second party to stomp on my firetruck if I don't make five commits to KS this week.
 
I thought about starting a smoking-rehab center that takes X money from you and returns X/12 each month you do not smoke (the goal being a year of non-smoking in a row)
 
3:32 PM
@ReutSharabani, I just switched to vaping a few years ago
 
However, there are two problems. I only have one firetruck, so I can't endlessly replicate the technique; and I could just game the system by making little weenie commits. "fixed typo in comment" x 5.
 
@PM2Ring, he should probably check that a .cfg file exists
or is accessible
 
commit log would show "saved firetruck"
 
We should just confiscate your MtG cards and return them when KS is Turing complete.
 
It already is Turing complete :-)
 
3:35 PM
@MarkR. That makes sense. And someone's just made a comment to that effect. I took a quick look at his link, but I wasn't about to look at the code for the module.
 
@MarkR. you line in Israel?
 
yep
 
where, and where do you work?
 
rhubarb time
 
@Kevin That's a shame. Now it can never "become" Turing complete and so you'll never get these cards back.
rbrb @PM
 
3:36 PM
sharon area, bursa/raanana most of the time
 
I'll move to Tel-Aviv / Ha'Sharon area when my gf graduates...
 
What will I do without my greatest vice? :-( I guess I'll just become a productive member of society.
 
Hoping to find a job :X
 
@ReutSharabani, my clients are always hiring Python people, let me know when you move away from the boonies
LOL, this guy here just pronounced "opacity" as "obesity"
 
@MarkR. sure, I'll probably hang in chat
 
3:40 PM
@ReutSharabani, where are you currently? I've got friends & family up north
 
Be'er Sheva, but I have a job that I like :) I think I'm scared of interviews so finding a job may be hard.
 
@Kevin Your fire truck is your greatest vice? My advice would be to get out more :P
 
But the world is so big and scary :-(
I have unironically looked out my window into the gray wastes and said to myself "there's nothing out there for me".
 
New Jersey isn't that bad.
 
Not sure if I'm the "before" half of a Paxil commercial, or if my hometown is just really boring.
 
3:52 PM
porque no los dos?
 
"Why no the two"? I ask myself that every day.
 
@Kevin Maybe you should make Paxil your new vice.
 
Acquiring a new vice costs six motivation points.
Oh, "why not both?" yeah that's possible.
 
user559633
@Ffisegydd yes, it is
 
Looks like it's time for Reddit's semi-weekly "SO sucks because" article
 
user559633
4:00 PM
"Someone asked a python question a while ago, I answered their question just fine. A mod erased my answer and within a few hours, someone had posted the exact same thing I did which was left alone.
There was no way to message the mod or to do anything at all. I was simply silenced. That was the last time I tried to help out there."

bullshit
 
At least there's a voice of reason:
> If it helps, you can raise it on meta, where the same people who deleted your comment will come there to disagree with you again.
;-)
 
user559633
But rabble rabble
 
The article itself does raise a valid point of "if you undertake the responsibility to police jerks, you will become a jerk yourself in time"
It's all to easy to catch an innocent question in the crossfire when you're shutting down dozens of bad guys a day
 
user559633
It's not like the question is closed without reason or explanation.
 
I dunno, I see a fair share of "unclear" votes that really should be "I just don't like this post and can't find a better reason" votes
Ex. the "How do I do list.index(item) but in reverse" question was perfectly clear
 
user559633
4:08 PM
Fair. But flagging your text as unclear.
 
;_;
 
user559633
Aww, don't cry. You're so ugly when you cry
 
I wonder if the site is really becoming less inclusive as they say, or if we've reached a steady state of non-inclusiveness.
Certainly, the "SO sucks because" posts have reached a steady state XD
 
user559633
I see this as the new normal.
 
user559633
It's the school year -- it's going to be a lot of "they called me on trying to make them do my homework!!!! >_<" noise
 
4:12 PM
Heh, the question from this post now has a self-answer. The system works!
 
Oh noes. Now more people on reddit will bitch cry and get their answers re-opened.
 
To be fair - when you're new, there's often a sense of people dishing out hell without any explanation
That's why I almost gave up StackOverflow the day after I joined
 
I feel like I had a pretty good handle on the site culture by the time I signed up. Just from reading a lot of SO posts during google searches in the months prior.
 
Well, I was googling, stumbled across a SO question (which I later found out should have been set on fire/closed), realised that I knew the answer and posted
Suddenly I was being downvoted/etc without any explanation as to why
Was a bit 0.0
I suspect that pre-reserch isn't the usual joining user case for SO users @Kevin ;)
 
I think my particular personality may be to blame there. I'm pretty critical of the things I write myself, so I take extra time to make sure I'm not transgressing somehow.
 
user559633
4:21 PM
Good, keep the poison out :)
 
Same. I lurked in chat for like a week before saying anything.
I've joined a photography website to share my photos/see other peoples. It's very good. Unfortunately it's also filled with lots of naked women. Had a few close calls in the office so far :/
I'll just be scrolling through some innocent landscape photography and then BAM some woman leaving nothing to the imagination.
 
user559633
That sounds way more fun than a website that shows me problems people are having with computers.
 
It's called 500px.com
 
That was an amazing (and wasted) opportunity to troll people Fizzy
 
I would never troll my friends.
 
4:25 PM
I tell my IRL friends "we always hurt the ones we love, because we know we can get away with it"
 
user559633
[redacted]
 
I really need to colour-calibrate my monitors. Unfortunately an actual colour-calibrator-machine is like £100.
 
That episode of Futurama was on Comedy Central yesterday :-)
It's the one where Fry suspects Flexo of stealing the giant atom.
And he makes ^that^ expression as he does so
Looking at my earliest SO answer, I didn't have the most upvotes, but I got the accept >:-)
Stealing the thunder of other users since day 1.
 
Was the other answerer DSM by any chance? As that'd be pretty perfect.
 
4:29 PM
TV is still a thing? I thought everyone just streamed everything still
 
It was a C question. And a dupe, now that I look at it again.
Hmm, I should downvote myself for answering a C question by quoting cplusplus.com
 
@Kevin You should downvote yourself for quoting cplusplus at all.
 
user559633
 
user559633
cplusplus is fine. what are you talking about
 
cppreference tends to be way more accurate
 
4:31 PM
If you want a vision of SO with no moderation, look no further than cplusplus.com's forum.
 
user559633
if you want a vision of Significant Others without moderation, look no further than the members-only website i'm starting
 
I was a regular there for a couple weeks. Eventually, I left because I was annoyed by this one user that put an upside down question mark in front of all their questions.
 
user559633
¿why would that bother you that much
 
Because he hates the Spanish, Kevin is a secret racist.
 
user559633
maybe he was a krogan
 
user559633
4:33 PM
@Ffisegydd ¿who doesn't
 
In the end, I wrote a user script that filtered all the '¿'s from posts, but I still knew they were there.
 
user559633
and kevinscript was born
 
Listen. If he was writing his questions in spanish, I would have no trouble with the upside down question marks. But you can't just port conventions from one language to another like that.
It's like letting your apple sauce touch your mashed potatoes.
 
Is...is that a euphemism?
 
user559633
delicious?
 
4:37 PM
C++ fine?
now that's an interesting adjective
 
They actually meant "Sorry we're going to take some money from you, for a C++ fine"
 
It wasn't intended as a euphemism, but Death of the Author and all that. Interpret as you will.
 
user559633
C++ is great
 
@Kevin Do you consider mashed potatoes a liquid or a solid?
 
It's a tricky question.
 
4:44 PM
Apparently the TSA considers them a gel.
 
I imagine that mashed potatoes exhibits liquid properties, but only over a longer period of time than it takes to eat them.
Ex. If I left them in bowl overnight, I'd expect it to conform to the shape of its container.
It would have to be at room temperature, though
 
We're actually getting worryingly close to my PhD here D:
 
5:06 PM
@Ffisegydd have you had a few flags declined since you started flagging more?
I've had two declined, flagged a few more that were accepted, and now today I can't flag.
 
user559633
I burninated two tags all on my own :)
 
72
A: Allow recovery from flag hellban

Shog9Update: Kevin Montrose makes it happen The hell-ban is no more! Long live the verbose, obnoxiously evident ban! Kevin has implemented (more or less) the system described below. Flaggers with a recent (past 7 days) flagging history consisting of at least 10 flags where >= 10% of flags were decli...

 
@davidism no I've not had any declined :( I tend to flag sure things though.
 
DSM
221 messages to scroll up..
 
Hi , should I leard Python or Ruby on rails ? Which language has better scope ? I am PHP dev(I work mostly on frameworks). Thanks.
 
5:18 PM
KevinMontrose = @Kevin ?
 
DSM
Not our Kevin.
 
o i c
 
DSM
Our Kevin's last name is Kevinson.
 
lol
or Kelvin
 
@jQuery.PHP.Magento.com Python, of course :-D
(ask in the Ruby room and they'll tell you "Ruby, of course :-D")
 
5:20 PM
@Kev
thanks :)
 
But seriously, I know very little about Ruby so I can't fairly compare the languages. I just know which one I like better :-)
 
DSM
Meeting I was at yesterday had a Ruby programmer suggesting it was easier to learn Python, which is why he recommended it to a nonprogrammer colleague.
 
This is 300 metres from my house.
 
I can confirm that I am not Kevin Montrose. At least, not by any definition understandable by mere three-plus-one dimensional beings.
 
ruby annoys me
it looks like python ... but then things dont work like theyre supposed to
 
DSM
5:22 PM
un voraz incendio!
Scary.
 
Looks dangerous! Stay safe, @Zero
 
I heard you have many {{{}}}}}}}}}}}}} in Python ?
 
oh yes
all over the place
 
Thanks to significant whitespace, we have fewer curly brackets than C++ and Java and friends.
 
from future import curlybraces
 
DSM
5:23 PM
We do use dictionaries a lot, though.
 
and format strings
 
Ah, so it's because I flag a lot, but didn't flag a lot in the last week when two were declined, so I've got to wait a week.
 
You can still use lots of { and [ and ( if you so choose, but proper design decisions can keep nesting of built-in types to a minimum.
 
and dictionay and set comprehensions
 
As they say, you can write bad code in any language.
 
5:24 PM
@Kevin It's two blocks away - actually I was wondering why the police had blocked the road when I went out half an hour ago.
 
DSM
But it's easier in some than others.
 
@jQuery.PHP.Magento.com no trolling, kicked
 
Never eaten in the Peruvian place, but the Chinese next door is handy if a bit average.
 
tengo un amigo que vive afuerito de santiago .... no me acuerdo el nombre del pueblo
 
user559633
ne ponimayu isplanskiy
 
5:27 PM
do you even chile
:P
 
user559633
i literally cant even chile
 
Peculiar error message here. Is len() of unsized object new with 3.5?
 
@Joran it's a big town ... a list of outer suburbs / neighbouring towns and villages would get tedious quickly.
 
DSM
@Kevin: print stmt means 2, no?
 
True.
Maybe it's 2.6 or below? I can't replicate in 2.7
 
DSM
5:29 PM
pypy says TypeError: 'int' has no length.
 
I get TypeError: object of type 'int' has no len()
 
DSM
Ha!
>>> import sys
>>> sys.version
'2.9.9a0 (IronPython 2.9.9a0 (2.9.0.0) on Mono 4.0.30319.17020 (64-bit))'
>>> len(2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: len() of unsized object
 
O.o
I didnt even know there was a 2.9
 
$ python3.5
Python 3.5.0a1 (default, Feb 10 2015, 10:28:34)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> len(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object of type 'int' has no len()
 
o iPython
 
5:30 PM
I'm using ActivePython 2.7.2.5, which I installed several years ago after ten seconds of googling. It occurs to me that maybe I should move to something more reputable???
 
DSM
Now whether this is because (1) it's an IronPython thing, or (2) the Python version that this is compatible with is old, I don't know.
 
I don't even know what the comparative reputations of each Python build are
 
@Kevin ActivePython is just a packaging of CPython.
It's a Windows build with packages and an installer, basically.
 
Wouldn't it be funny if I had been training with a non-standard implementation all these years. Something that, strictly speaking, isn't Python. I'd have some serious soul searching to do there.
@MartijnPieters Oh good, no soul searching for me then.
 
DSM
The computer that I keep all my old Python builds on for exactly this reason isn't accessible. :-(
Python 2.4.2 (#4, Dec 29 2005, 17:51:44)
[GCC 2.95.4 20011002 (Debian prerelease)]
>>> len(2)
Traceback (most recent call last):
    TypeError: len() of unsized object
 
5:33 PM
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> len(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object of type 'int' has no len()
>>>
 
DSM
So it's not a new message, it's an old one, and it changed sometime between 2.4.2 and 2.6.6.
 
2.5 has the new message.
$ python2.5
Python 2.5.6 (r256:88840, Feb 10 2015, 10:11:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> len(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object of type 'int' has no len()
$ python2.4
Python 2.4.6 (#1, Feb 10 2015, 10:08:07)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> len(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: len() of unsized object
So there we have it. Old Python release.
 
DSM
We already knew that, all you did was tighten the bounds. :-)
 
Aha! This guy looks pretty dodgy to me – I think we have our arsonist.
 
DSM
Who would wear a blurry mask if he wasn't up to no good?
 
5:39 PM
man I am gettign a nice chunk of $$$$$ back from taxes :)
maybe i can actually get some sweet new hardware
 
are you gonna gamble it all away? ;)
 
@ZeroPiraeus Did he arrive in this vehicle perhaps?
 
@DSM I was going to go dig up the 2.3 build I still have though.
 
cbg
I have 1.0
 
5:51 PM
is memoization a required component of dynamic programming? I think so ... but i figured id ask
 
but it is buggy
101
@JoranBeasley sort of
 
I cant think of anything that would be considered DP that doesnt do memoization
 
I'll go with "no, but it's a very nice feature to have"
 
The dynamic programming approach seeks to solve each subproblem only once, thus reducing the number of computations: once the solution to a given subproblem has been computed, it is stored or "memo-ized": the next time the same solution is needed, it is simply looked up.
 
I consider the recursive fibonacci function as DP, even if you don't memoize
 
5:52 PM
hence it is required
oh since you dont have to recompute with fibonacci ... so each thing is onyl computed 1x anyway
 
but it does not mean that it is a function that is memoized by decorator
you can table the stuff...
 
well, the return f(x-1) + f(x-2) version does recompute already computed values
 
*meaning it does not even need to be *recursive solution
 
@AnttiHaapala yeah yeah I didnt mean any one particular way i just meant it had to store it somewhere
 
5:54 PM
Which is why it's so dang slow
 
ergo if it is recomputing then it would likely not be dp solution?
 
@Kevin ah thinking of it, I'd say recursive fib is not dp
actually iterative fib is more of dp :P
 
By the definition you gave above, I agree
Ok, I'm changing my opinion to "yes, memoization is needed"
Hmm, I half-answered a question that would otherwise have received no answer at all. Not sure if good idea.
Oh, here's the reason no one saw it, it didn't have the tag.
There, now that it's visible, I impatiently await the arrival of more qualified answerers
 
6:14 PM
re-cbg
 
6:34 PM
I'm annoyed by the film The Lazarus Effect because I think it paints an unflattering picture of the dangers of bringing people back from the dead.
 
i really dont want to see that movie ... it looks like a crappy version of that old keifer southerland movie
 
What if this film came out a hundred years ago? Maybe CPR and defibrillators wouldn't have been invented, since they "toy with unknown forces"
Clinically dead people become alive all the time! And they're probably not all possessed by demons.
@JoranBeasley Flatliners?
 
yeah
that
 
I think they're approaching the narrative from a different angle - here, the POV characters are the doctors trying to revive their friend. In Flatliners, you get to see what the dying people actually see.
 
user559633
Kevin's face staring back at them?
 
6:42 PM
yeah but it still looks sorta like a bullshit hackjob of flatliners :P
 
Looks like spooky jumpscare film #48151623 to me
 
yeah ... also that
 
OP's comment seems to indicate that he intended for two variables to have different names, but missed them while actually writing the code.
So, typo, I guess
 
yeah, typo
 
6:59 PM
I wonder if it's worth commenting on the answer that a for loop doesn't have a different scope as the code surrounding it.
 
wtf
@MartijnPieters I posted solution to that tuple q and someone downvoted me in 1 second
 
@AnttiHaapala I know! And a solution that alternate Kevin is imploring me to use.
 
someone made a robot to downvote my solutions as soon as I post them
 
DSM
I saw someone use enumerate even though he wasn't using the value, only the index, and so could just as easily have used range, presumably because he thought it was more pythonic.
 
I am a bit tired and it takes quite a some time to do coding
I post to get instant -1
maybe some day like this I will rage quit SO
 
user559633
7:05 PM
:[
 
ah rbrb I am off to bed
 
@AnttiHaapala :-/ Not your day, downvote #2.
Ah, retracted again.
 
I got even uglier pattern
i = iter(l)
result = [ j[:2] + next(i)[:2] for j in i ]
print result
hmm someone is doing vote lottery on my posts today
 
DSM
7:23 PM
I've occasionally felt the impulse to downvote something when I'm working on a post and somebody else beats me to it. I could imagine someone giving in to that impulse.
 
I just never look into other posts
now I saw that "someone posted something" I was like "anw."
wrote my thing hit submit noticed it was martijns and martijn use xrange and then I got downvote
 
Sometimes late at night, I think "why don't I downvote everyone's answers except my own?"
 
@DSM i just stop answering
 
mmm wanna do some speed testing
I have a hunch that martijns answer is still faster
 
I guess serial downvoting all your competitors is the easiest kind to detect and revert
if all(answer.is_downvoted_by(user) or answer.is_written_by(user) for answer in question.answers):
 
7:28 PM
@Kevin Experiment: write an SO question asking how you can write a bot that watches questions you've answered and downvotes all rival answers. Extra points if you can attract five different close-vote reasons.
 
You may end up losing more rep than you gain
 
In [9]: %timeit [tups[i][:2] + tups[i + 1][:2] for i in xrange(0, len(tups), 2)]
10000 loops, best of 3: 23.5 µs per loop

In [10]: %timeit i = iter(tups); [ j[:2] + next(i)[:2] for j in i ]
10000 loops, best of 3: 24.8 µs per loop
martijn's is faster
guess because the global name access for next
 
Heh, when you said speed testing, I thought you meant your Internet connection.
"I could beat Martijn, if only my ping was better!"
3
 
try with more loops. 1.5 microsecs isn't much
 
it is best of 3 and 3 times :D
it is enough loops
I think the next() penalty is high
In [15]: %timeit [tups[i][:2] + tups[i + 1][:2] for i in xrange(0, len(tups), 2)]
^[[A10000 loops, best of 3: 23 µs per loop

In [16]: %timeit i = iter(tups); n = i.next; [ j[:2] + n()[:2] for j in i ]
10000 loops, best of 3: 21 µs per loop
hehe :P
 
DSM
7:32 PM
What is tups?
 
and we have a winner
200 item list for testing that code there...
 
DSM
7:51 PM
@Ffisegydd: did you eat rhubarb?
 
@DSM I did, but then I had some cabbage.
 
DSM
@Ffisegydd: seaborn question. Is there an easy way to access the "standard" six colour values by name?
IOW, I want to set color='blue' but get the first colour here.
 
This guy is using 1 and "" instead of True and False. It displeases me greatly.
Oh, I think by "hasn't been initial" he means "when I create a new instance of the class, langs retains values that were added by previous instances". In other words, langs hasn't been reinitialized.
 
do dogs experience jealousy?
 
In which case, as a dupe of that one "how not to have shared state amongst instances" post from the other day
 
7:57 PM
@DSM hmmm. no idea sorry :/
 
DSM
@Ffisegydd: no worries. Can always name 'em myself off the palette.
 
@DSM I suppose if you could get the xkcd palette name
 
... Anyone happen to know what dupe target I'm talking about?
 

« first day (1586 days earlier)      last day (3365 days later) »