« first day (1427 days earlier)      last day (3530 days later) » 

10:00 PM
I'd just leave it be for the moment @Humdinger
 
@JonClements Too clever not to require a little explanation, I think ...
... but clever enough for an upvote :-)
 
I'd probably appreciate it as a newb the difference (at least in some sense) that can allow me to focus on one thing I'm operating on, rather than worrying about mutating and worrying about re-binding from range... etc...
we can worry about that later on in our learnings :)
@Zero which bit would you suggest explaining?
(I just thought it might clearer than Padriac's)
 
Well, the last three lines are the clever bit ...
You're relying on a near-side-effect of partition, then using both setdefault (uncommon) and short-circuit logic (not immediately obvious unless you know it).
It's all quite elegant, but quite dense for someone inexperienced.
 
Umm... I'll add comments later
I was going to wait until they tried it, and complained it broke (which it will if no name is set in the first line of input), though
 
10:15 PM
What's the dumbest question you're asked on a consistent basis here?
 
Yeah, fair enough ... didn't think through enough to spot the first line thing, but that could bite OP down the line. Rereading, I still think the combination of setdefault, short-circuit and falsey empty string behaviour is a lot for one line given assumed competence of questioner.
 
@SomeKittens we enjoy a highly educated audience... we don't have dumb questions - I know not what you're implying...
Besides, I think @Zero keeps the key to that library
Buying an old warehouse from Amazon wasn't cheap, but... oh well....
 
@SomeKittensUx2666 "Does anyone know Django?"
 
@Zero "Yes, I met him down the pub last week..."?
 
To which the answer is, of course: "Yes." :-)
Beat me to it ;-)
 
10:18 PM
heh
 
@SomeKittens I imagine you have more issues in the JS room, than we do?
 
We have a lot of issues with noobs, yes
 
... or "I believe he and Dr. King Schultz are acquainted" ...
 
Wow... and the new Avatar blocking is live it appears
 
So it is! Blimey, chat is finally getting some love - and we presumably have a certain nutter to thank ...
 
10:21 PM
after so long - it's getting some TLC!
 
Welcome @user3487219 - I'm afraid you can't speak in chat until you have 20 reputation, but you're welcome to spectate until then :-)
 
10:36 PM
I just ate 10 pomegranates
 
Quite looking forward to tomorrow's DW - from the trailer, looks like a good old scary ep of the sort Moffat excels at :-)
@corvid Dare you to drive?
 
I'm about to drive out to get more pomegranates, this is AWESOME
 
@corvid nice to have met you... we'll make sure to put a nice remembrance in the next room meeting
your contributions to the room and the site shall never be forgotten
 
10:51 PM
This is interesting ... two upvotes for stackoverflow.com/questions/19608134/… in two days. There don't seem to be any other recent questions linking to it ... I wonder why it's getting attention after all this time?
 
lets say I have a lists of dicts [{'name':'cbg', ...}, {'name':'lettuce', ...}] is there a quick way to get the dictionary in the list where its item name=cbg?
 
DSM
next(d for d in list_of_dicts if d["name"] == "cbg")
 
So the example output from above would be (as a list)....
 
@Humdinger DSM's answer (which I was also in the middle of writing, grr) is ideal if you know there's exactly one match - otherwise a listcomp might be more sensible.
 
DSM
Yep. And you might want d.get("name") == "cbg" if you're not sure that name will be a key.
 
10:59 PM
I can be sure it will be a key, How would I use listcomp? (I am new to this 'magic python keyword' stuff)
 
[d for d in list_of_dicts if d["name"] == "cbg"]
Gives you a list, rather than the next result from a generator expression.
 
@Zero yeah, but wrap @DSM's in a gen-exp with the next, you can provide a default :)
depends if you're expecting none, 1 or 1+
 
I am expecting none or 1
ok, expecting 1. But i should handle the 0 case
I know that 1+ case wont happen
 
In that case @Jon is probably right: next((d for d in list_of_dicts if d["name"] == "cbg"), None)
 
I like it. Thanks :)
Free cabbage for all 3 of you
 
DSM
11:05 PM
free cabbage w00t
 
That was interesting - just had to sort out "screaming in the bathroom"
"there's a spider - there's a spider - it's huge!!!!!!!!!!!!!!!!"
 
let me guess, it was smaller than a penny
 
I have a friend that stays occasionally, and she's fine with most things
 
or even a thumbtack
 
spiders? she just freaks
 
11:08 PM
My sister is like that
She is like an adrenaline junkie. She goes hunting, she camps, etc. with no problem. But when she sees a tiny spider, you would think the world was going to end
 
Fun fact: the only potentially deadly spiders in Chile are quite small and harmless-looking, and they love hiding behind things in warm dry houses.
Feel free to pass this info on to your friend, @Jon ;-)
 
@Zero yeah, if I was there, or in Oz, I'd be more wary
 
The Chilean recluse spider is a venomous spider, Loxosceles laeta, of the family Sicariidae (formerly of the family Loxoscelidae). In Spanish, it (and other South American recluse spiders) is known as araña de rincón, or "corner spider"; in Portuguese, as aranha-marrom or "brown spider". This spider is considered by many to be the most dangerous of the recluse spiders, and its bite is known to frequently result in severe systemic reactions, including death. == Description and habitat == The Chilean recluse is one of the larger species of recluse spiders, generally ranging from 8–40 mm in size ...
 
I am sooooooo tempted to tell her it was that :)
 
I've never seen one bigger than 1.5cm though.
 
11:10 PM
@JonClements It would be funny.. but it might increase her fear, and it will end up causing you more pain in the long run
 
pomegranates, why must you go out of season so cruely? And come into season at the same time of glorious apples
 
DSM
I think Kevin is the wittiest of us, but corvid's non sequiturs are almost as good.
 
are you star baiting me sir @DSM :)
@DSM what you do think about stackoverflow.com/questions/25817930/…
Miss Andy - use to be a regular
probably should have said "I miss Andy" - instead of possible misreading of my previous post :)
 
DSM
I had a "time to update hi-- er, Andy's -- google image.." joke in the ready.
 
@DSM @Zero my mate in Oz is now very, very careful about spiders and snakes
 
11:15 PM
Yes, I think I would be too.
I do like scorpions, though. They're cute (and AFAICT no more dangerous than wasps around here).
 
he once said to me, if it wasn't for spending his life with his wife, he'd had prefered to say in England where native creatures couldn't kill you
 
... unless you count people leaving pubs on a Friday night ...
 
We got what the "grass snake"?
and errr...
 
DSM
As for the question, I think he's probably right. The OP wants to sort by value and ignore the column association, and the standard way to do that is to drop to .values.
 
You could get sat on by a cow.
 
11:20 PM
@DSM so - was T'ing, sorting, then .T'ing it back a completely stupid suggestion?
 
DSM
I'm not quite sure I get the reason to transpose.
 
oh - re-read - he wants to sort each column in each row
 
DSM
ohh, wait. You're trying to minimize the looping.
 
but that T should still work
I just read it as transpose the entire thing, sort it, transpose it again
makes more sense than sorting your columns per row into different columns
(can't think of a use-case for that really)
 
DSM
If we had a slow loop over lots of rows and a cheap transpose then it could make sense.
 
11:26 PM
I made a tDCS machine today but I am too afraid to try it cause I'll probably fry my brain.
 
DSM
Okay, time to head home -- after seeing if I can talk my way into the free smoothie that was stolen yesterday because the kid behind the counter punched the wrong cell on the card..
 
Anyone else have Civ5 ?
Only played it for 3/4 hours now...
bit weird from the original 1/2
 
DSM
Evening rhubarb to all!
 
@DSM rbrb!
 
11:41 PM
Compare and contrast:
http://stackoverflow.com/questions/25818342/how-can-i-turn-a-list-of-pairs-of-coordinates-in-string-form-into-a-list-of-pair
http://stackoverflow.com/questions/25713539/how-can-i-read-in-my-file-line-by-line-with-each-line-as-a-list-of-floats
Just barely not a dupe ... but boy is it hard not to get sarcastic ...
 
dupe enough for me
 
Hokeydoke :-)
 
they should extend their original Q with a comment/edit rather than what's pretty much a repost
it's not an "exact" dupe
but it's close enough to be warranted to go back to the original Q IMHO
 
Downvoted in the end ... shows no thought whatsoever.
 
bbias
what annoys me the most is when people from question to question using other answers as "their code"
if they say, "I asked this question here, and got this code" - I'm happy
passing it off as your own code though... displeases the puppy ;)
 
11:54 PM
I had a student propose an unorthodox solution to a problem in their homework, concerned that it was "cheating"
It was a very clever solution, and I told him so. I added that "cheating" wasn't really a thing when it came to programming - except for the very blatant exception of plagiarism.
 
The Carmack hack springs to mind :-)
 
It's fun to watch them realize that all the artificial constraints are gone.
 

« first day (1427 days earlier)      last day (3530 days later) »