On 6/28/2010 10:49 AM, Stephen Hansen wrote:
Now, if you are entering a generator where its not 'on its own' and its
not ambiguous-- such as inside a function call-- you don't have to
surround it by its own parens. So you don't have to do f((i for i in
range(4)).
You need another ) on the end.
On 6/28/10 5:47 AM, Li Hui wrote:
> When write
> >>>i for i in range(16)
> I get "SyntaxError: invalid syntax"
>
> but When I use it like this:
> >>>def f(x):\
> ... pass
> >>>f(i for i in range(16))
>
> all is right
> I think it maybe f((i for i in range(16)))
The " for in " syntax is actu
When write
>>>i for i in range(16)
I get "SyntaxError: invalid syntax"
but When I use it like this:
>>>def f(x):\
... pass
>>>f(i for i in range(16))
all is right
I think it maybe f((i for i in range(16)))
--
Li Hui
http://www.lihui.org
--
http://mail.python.org/mailman/listinfo/python-list