Y
Hacker News
new
|
ask
|
show
|
jobs
by
mildtrepidation
4481 days ago
When did support for dictionary comprehensions make it into 2.x? I could've sworn it didn't used to work, but I just tried it in the shell and sure enough, it does in 2.7.3.
2 comments
maxerickson
4481 days ago
2.7:
http://legacy.python.org/dev/peps/pep-0274/
link
chingjun
4480 days ago
Wow I didn't know that! I was always doing something like this
mi = dict((v,k) for k,v in m.iteritems())
link
http://legacy.python.org/dev/peps/pep-0274/