|
|
|
|
|
by ul5255
5292 days ago
|
|
Whatever goes inside a lambda must be an expression. The parentheses around yield make it a yield expression. Otherwise yield would be a statement which is a different thing as far as Python is concerned. You can also use it inside generators: >>> def f():
while True:
xyz = (yield)
print xyz
>>> g = f()
>>> g.next()
# nothing happens as xyz == None
>>> g.send('huhu')
huhu
|
|