Arnaud Delobelle wrote: > Lie <[EMAIL PROTECTED]> writes: >> What makes a generator expression is "<exp> for <var-or-tuple> in >> <exp>". >> >> Parenthesis is generally required because without it, it's almost >> impossible to differentiate it with the surrounding. But it is not >> part of the formally required syntax. > > ... But *every* generator expression is surrounded by parentheses, isn't > it? > Indeed, the syntax production is:
generator_expression ::= "(" expression genexpr_for ")" albeit with the note: "The parentheses can be omitted on calls with only one argument. See section 5.3.4 for the detail." but that only means you don't need a second set of parentheses. A generator expression is always enclosed in parentheses, the same is NOT true of a tuple. -- http://mail.python.org/mailman/listinfo/python-list