[issue4748] yield expression vs lambda

Georg Brandl report at bugs.python.org
Sat Dec 27 19:15:40 CET 2008


Georg Brandl <georg at python.org> 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 think so too. I just wondered at the seemingly inconsistent
behavior right now.

>> Anyway, perhaps yield in lambdas should be forbidden.
> 
> Probably too late now for 2.x and 3.x.

Right. I'd say go for applying the patch.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4748>
_______________________________________


More information about the Python-bugs-list mailing list