[Tutor] list of dicts <-> dict of lists?

Steven D'Aprano steve at pearwood.info
Fri May 28 02:56:09 CEST 2010


On Fri, 28 May 2010 09:44:36 am Matthew Wood wrote:

> That said, the version with an extra line will work on python < 2.6,
> so I'd probably just leave it that way.

Why?

That's like saying:

"I could write y = x+2 in Python, but y = 1+x+1 will work too, so I'll 
write that instead, just in case."

Yes, I suppose that there are buggy Python implementations where x+2 
doesn't work correctly but 1+x+1 does, and there might be stupid data 
types that are the same, but do you really need to support such 
badly-behaved objects?



-- 
Steven D'Aprano


More information about the Tutor mailing list