On Fri, Sep 17, 2010 at 21:44, Raymond Hettinger raymond.hettinger@gmail.com wrote:
My question for the group is whether it would be a good idea to drop the new restriction.
I like the restriction and would actually advocate having it for regular for-loops too (though that would be a big no-no, I guess).
Here's why I never use them without parenthesis, in python 2:
(1 if True else 3, 4)
(1, 4)
(lambda x: x * x, 6)
(<function <lambda> at 0x100475ed8>, 6)
[i for i in 2, 3]
[2, 3]
(i for i in 2, 3)
File "<stdin>", line 1 (i for i in 2, 3) ^ SyntaxError: invalid syntax
And in Python 3:
(1 if True else 3, 4)
(1, 4)
(lambda x: x * x, 6)
(<function <lambda> at 0x7f4ef41785a0>, 6)
[i for i in 2, 3]
File "<stdin>", line 1 [i for i in 2, 3] ^ SyntaxError: invalid syntax
(i for i in 2, 3)
File "<stdin>", line 1 (i for i in 2, 3) ^ SyntaxError: invalid syntax
Cheers,
Dirkjan