Re: Generator expression parenthesis mixed with function call ones

2007-03-08 Thread Laurent Pointal
Gabriel Genellina a écrit : > If you want to review the original discussion on how to spell a > generator expression (called "accumulator display" by that time) see > http://mail.python.org/pipermail/python-dev/2003-October/038868.html That's a long discussion... and it seem I'm not alone to disli

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 15:21:57 -0300, Laurent Pointal <[EMAIL PROTECTED]> escribió: > Gabriel Genellina wrote: > >> En Wed, 07 Mar 2007 12:53:43 -0300, Laurent Pointal >> <[EMAIL PROTECTED]> escribió: >> >>> Why does Python allow generator expression parenthesis to be mixed with >>> function call

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Laurent Pointal
Gabriel Genellina wrote: > En Wed, 07 Mar 2007 12:53:43 -0300, Laurent Pointal > <[EMAIL PROTECTED]> escribió: > > f(4,i for i in range(10)) >> File "", line 1 >> SyntaxError: invalid syntax > > 2.5 has a better error message: > py> f(4,i for i in range(10)) >File "", line 1 > SyntaxEr

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Laurent Pointal
Dennis Lee Bieber wrote: > On Wed, 07 Mar 2007 17:15:33 +0100, Laurent Pointal > <[EMAIL PROTECTED]> 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 [

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 12:53:43 -0300, Laurent Pointal <[EMAIL PROTECTED]> escribió: f(4,i for i in range(10)) > File "", line 1 > SyntaxError: invalid syntax 2.5 has a better error message: py> f(4,i for i in range(10)) File "", line 1 SyntaxError: Generator expression must be parenthes

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Laurent Pointal
Facundo Batista a écrit : > Laurent Pointal wrote: > > > f(4,i for i in range(10)) >> File "", line 1 >> SyntaxError: invalid syntax >> >> >> Why does Python allow generator expression parenthesis to be mixed with >> function call parenthesis when there is only one parameter ? > > For simp

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Facundo Batista
Laurent Pointal wrote: f(4,i for i in range(10)) > File "", line 1 > SyntaxError: invalid syntax > > > Why does Python allow generator expression parenthesis to be mixed with > function call parenthesis when there is only one parameter ? For simplicity and elegant coding, so you can do so

Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Laurent Pointal
[Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32] Given the following: >>> sum(i for i in range(10)) 45 >>> def f(*args) : print args ... >>> f(i for i in range(10)) (,) >>> def f(a,*args) : print a,ar ... >>> f(4,i for i in range(10)) File "", line 1 SyntaxError: