Generator expression parenthesis mixed with function call ones

Laurent Pointal laurent.pointal at wanadoo.fr
Wed Mar 7 13:10:49 EST 2007


Dennis Lee Bieber wrote:

> On Wed, 07 Mar 2007 17:15:33 +0100, Laurent Pointal
> <laurent.pointal at limsi.fr> declaimed the following in comp.lang.python:
> 
>> 
>> How a Python beginner know that he is using a generator and not a
>> list-comprehension ?
>>
> A list comprehension ALWAYS has list brackets [...] around it...

Yes, and a generator expression ALWAYS has round brackets... which can be
confused with function call ones when it is used in a single argument
function call...
I still personnaly think function call round brackets and generator
expression round brackets should both be present.




More information about the Python-list mailing list