map/filter/reduce/lambda opinions and background unscientific mini-survey
Steven Bethard
steven.bethard at gmail.com
Fri Jul 8 13:03:54 EDT 2005
Christopher Subich wrote:
> Ron Adam wrote:
>> I think the association of (lambda) to [list_comp] is a nice
>> distinction. Maybe a {dictionary_comp} would make it a complete set. ;-)
>
> Yeah, dictionary comprehensions would be an interesting feature. :)
> Syntax might be a bit unwieldy, though, and I doubt they'd be used often
> enough to be worth implementing, but still neat.
Dict comprehensions were recently rejected:
http://www.python.org/peps/pep-0274.html
The reason, of course, is that dict comprehensions don't gain you much
at all over the dict() constructor plus a generator expression, e.g.:
dict((i, chr(65+i)) for i in range(4))
STeVe
More information about the Python-list
mailing list