Help with creating a dict from list and range
Fredrik Lundh
fredrik at pythonware.com
Sun Oct 16 07:03:57 EDT 2005
Steve Holden wrote:
> Question: what's the difference between
>
> dict((name, seq) for seq, name in enumerate(description))
>
> (the improved version of my answer posted by Scott David Daniels) and
>
> dict(enumerate(description))
a missing
def enumerate(x, enumerate=enumerate): # override
return (reversed(x) for x in enumerate(x))
before the dict call?
(dict(reversed(x) for x in enumerate(description)) isn't too bad, btw)
</F>
More information about the Python-list
mailing list