[Python-ideas] dictionary unpacking

Giampaolo Rodola' gnewsg at gmail.com
Wed Apr 2 04:25:08 CEST 2008


On 31 Mar, 16:17, Mathias Panzenböck <grosser.meister.mo... at gmx.net>
wrote:
> Maybe dictionary unpacking would be a nice thing?
>
>  >>> d = {'foo': 42, 'egg': 23}
>  >>> {'foo': bar, 'egg': spam} = d
>  >>> print bar, spam
> 42 23
>
> What do you think? Bad idea? Good idea?

I think this is one of the oddest things I've ever seen proposed until
now. :)
Actually I realized what was that for only after having seen Facundo's
list comprehension translation.



More information about the Python-ideas mailing list