[Python-Dev] Re: accumulator display syntax
Alex Martelli
aleaxit at yahoo.com
Sat Oct 25 10:18:42 EDT 2003
On Wednesday 22 October 2003 05:27 am, David Eppstein wrote:
...
> Currently, I am using expressions like
>
> pos2d =
> dict([(s,(positions[s][0]+dx*positions[s][2],positions[s][1]+dy*positions[s
> ][2]))
> for s in positions])
I _must_ be getting old -- it would never occur to me to write something
as dense and incomprehensible (and no, removing the "dict([" would not
make it much clearer). Something like:
pos2d = {}
for s, (x, y, delta) in positions.iteritems():
pos2d[s] = x+dx*delta, y+dy*delta
seems just SO much clearer and more transparent to me.
Alex
More information about the Python-Dev
mailing list