On Wed, 05 Nov 2008 12:06:42 +1100, Ben Finney wrote:
> Falcolas <[EMAIL PROTECTED]> writes:
>
>> Using the surrounding parentheses creates a generator object
>
> No. Using the generator expression syntax creates a generator object.
>
> Parentheses are irrelevant to whether the expression is a generator
> expression. The parentheses merely group the expression from surrounding
> syntax.
No they are important:
In [270]: a = x for x in xrange(10)
------------------------------------------------------------
File "<ipython console>", line 1
a = x for x in xrange(10)
^
<type 'exceptions.SyntaxError'>: invalid syntax
In [271]: a = (x for x in xrange(10))
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list