Is there a better/simpler way to filter blank lines?
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Tue Nov 4 20:33:19 EST 2008
On Wed, 05 Nov 2008 12:06:42 +1100, Ben Finney wrote:
> Falcolas <garrickp at gmail.com> 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
More information about the Python-list
mailing list