Re: Oddity with 'yield' as expression - parentheses demanded

2013-08-01 Thread Terry Reedy
On 8/1/2013 1:58 PM, Chris Angelico wrote: On Thu, Aug 1, 2013 at 6:35 PM, Ian Kelly wrote: yield was a statement before it became an expression, and the syntax "yield x, y, z" was (and still is) perfectly legal, with all three expressions (technically a single tuple expression) being governed

Re: Oddity with 'yield' as expression - parentheses demanded

2013-08-01 Thread Chris Angelico
On Thu, Aug 1, 2013 at 6:35 PM, Ian Kelly wrote: > yield was a statement before it became an expression, and the syntax > "yield x, y, z" was (and still is) perfectly legal, with all three > expressions (technically a single tuple expression) being governed by > the yield. That is to say, "yield

Re: Oddity with 'yield' as expression - parentheses demanded

2013-08-01 Thread Ian Kelly
On Thu, Aug 1, 2013 at 12:25 AM, Chris Angelico wrote: > Was playing around with yield inside a lambda and ran into a distinct oddity. > > Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 > 32 bit (Intel)] on win32 foo=lambda x: yield(x) > SyntaxError: invalid syntax

Oddity with 'yield' as expression - parentheses demanded

2013-07-31 Thread Chris Angelico
Was playing around with yield inside a lambda and ran into a distinct oddity. Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 >>> foo=lambda x: yield(x) SyntaxError: invalid syntax >>> def foo(x): return yield(x) SyntaxError: invalid syntax >>