[Python-ideas] Tuple Comprehensions

Ben Finney ben+python at benfinney.id.au
Tue Oct 18 06:57:03 CEST 2011


Steven D'Aprano <steve at pearwood.info> writes:

> Your proposed syntax for tuple comprehensions:
>
> (expr for x in iterable)
>
> Syntax already used for generator expressions:
>
> (expr for x in iterable)

More precisely, the parens are not part of the syntax for generator
expressions. But the above syntax is a valid, paren-enclosed, generator
expression; so the proposed syntax is indistinguishable from
already-valid syntax that means something else in existing code.

-- 
 \       “We must respect the other fellow's religion, but only in the |
  `\       sense and to the extent that we respect his theory that his |
_o__)     wife is beautiful and his children smart.” —Henry L. Mencken |
Ben Finney




More information about the Python-ideas mailing list