Dict comprehensions - improvement to docs?

Paul Rubin no.email at nospam.invalid
Mon Mar 16 02:22:31 EDT 2015


"Frank Millman" <frank at chagford.com> writes:
> I like dict comprehensions, but I don't use them very often, so when I do I 
> need to look up the format.

I never felt a need for them.  Do they generate better code than

   d = dict((k,v) for k,v in [('name','paul'),('language','python')])  ?

Anyway, since they are syntax, they'd be in the language refrence rather
than the library reference.



More information about the Python-list mailing list