[issue4748] yield expression vs lambda

2008-12-27 Thread Benjamin Peterson
Benjamin Peterson added the comment: Fixed in r67954. -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Pytho

[issue4748] yield expression vs lambda

2008-12-27 Thread Georg Brandl
Georg Brandl added the comment: >> Hmm, I wonder why lambda: (yield 1) alone doesn't give [1, None]. (That >> should also go into the test case.) > > Actually, I don't think the return value should even make it's way to > the list. Generator lambdas shouldn't have any return value IMO. Yes, I t

[issue4748] yield expression vs lambda

2008-12-27 Thread Benjamin Peterson
Benjamin Peterson added the comment: On Sat, Dec 27, 2008 at 11:41 AM, Georg Brandl wrote: > > Georg Brandl added the comment: > > I didn't find it, but someone from the German Python webforum. :) > > Hmm, I wonder why lambda: (yield 1) alone doesn't give [1, None]. (That > should also go into

[issue4748] yield expression vs lambda

2008-12-27 Thread Georg Brandl
Georg Brandl added the comment: I didn't find it, but someone from the German Python webforum. :) Hmm, I wonder why lambda: (yield 1) alone doesn't give [1, None]. (That should also go into the test case.) Anyway, perhaps yield in lambdas should be forbidden. _

[issue4748] yield expression vs lambda

2008-12-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: Attaching patch? BTW, how did you find this bug? :) -- keywords: +needs review, patch nosy: +benjamin.peterson stage: -> patch review type: -> behavior Added file: http://bugs.python.org/file12467/nasty_lambda_generators.patch ___

[issue4748] yield expression vs lambda

2008-12-26 Thread Georg Brandl
New submission from Georg Brandl : With lambda, the ban on "return x" in generators can be evaded: >>> x = lambda: ((yield 1), (yield 2)) >>> list(x()) [1, 2, (None, None)] >>> dis.dis(x) 1 0 LOAD_CONST 0 (1) 3 YIELD_VALUE 4 LOAD_CONST