New submission from Georg Brandl <ge...@python.org>:

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               1 (2)
              7 YIELD_VALUE
              8 BUILD_TUPLE              2
             11 RETURN_VALUE

----------
messages: 78291
nosy: georg.brandl
priority: high
severity: normal
status: open
title: yield expression vs lambda
versions: Python 2.6, Python 3.0

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4748>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to