[Python-Dev] Re: accumulator display syntax
David Eppstein
eppstein at ics.uci.edu
Wed Oct 22 12:23:43 EDT 2003
In article <16278.34154.245725.959203 at montanaro.dyndns.org>,
Skip Montanaro <skip at pobox.com> wrote:
[ re a long expression of mine ]
...
> pos2d = dict([(s,(positions[s][0]+dx*positions[s][2],
> positions[s][1]+dy*positions[s][2]))
> for s in positions])
...
> pos2d = {s: (positions[s][0]+dx*positions[s][2],
> positions[s][1]+dy*positions[s][2])
> for s in positions}
>
> The extra characters required today are less of a problem if the expression
> is laid out sensibly.
I have to admit, your indentation is better than mine, even if you
ignore the problems caused by my using lines wider than 80 characters.
But I still feel the second of your two alternatives more clearly
expresses the intent of the expression.
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-Dev
mailing list