python coding contest
Alex Martelli
aleax at mail.comcast.net
Sun Jan 1 20:04:38 EST 2006
Christian Tismer <tismer at stackless.com> wrote:
> Hans Nowak wrote:
>
> > ... for u in(3,14,10))
> >
> > can be written as:
> >
> > ... for u in 3,14,10)
> >
> > which would shave off a character. Tuples don't always need parentheses...
>
> This would work with a list comprehension.
> Doesn't work with a generator expression
> (thought of it, too, and the list comprehension eats one char)
Right. I asked Guido about that, as he put together the 120-chars
submission of "Team Google" (including some input from me and others),
and he says it's to avoid (human) ambiguity, much like the reason the
parentheses are mandatory in [(a,b) for ...].
Alex
More information about the Python-list
mailing list