#4748 lambda generators shouldn't return values

This commit is contained in:
Benjamin Peterson 2008-12-27 18:24:11 +00:00
parent c3a9803410
commit 8d5934b25d
3 changed files with 18 additions and 1 deletions

View file

@ -928,6 +928,16 @@ Test the __name__ attribute and the repr()
'f'
>>> repr(g) # doctest: +ELLIPSIS
'<generator object f at ...>'
Lambdas shouldn't have their usual return behavior.
>>> x = lambda: (yield 1)
>>> list(x())
[1]
>>> x = lambda: ((yield 1), (yield 2))
>>> list(x())
[1, 2]
"""
# conjoin is a simple backtracking generator, named in honor of Icon's