[Python-ideas] return value of yield expressions
stefan_ml at behnel.de
Tue Sep 13 14:21:31 CEST 2011
Jacob Holm, 13.09.2011 13:02:
> args, kwds = (yield ret) # any expression really
> (a1, a2, a3, *args), kwds = (lambda a1,a2,a3=default,*args, **kwds:
> (a1,a2,a3)+args, kwds
> )(*args, **kwds)
Note that recent Python versions support extended argument unpacking, so
a1, *other, a2 = return_some_sequence()
If you use the last value of the returned sequence (such as a tuple) to
pass a dict, or if you return a tuple with two arguments (posargs,
kwargdict), you basically get what you wanted above.
Time machine keys are back were they were. Nothing to see here, keep passing.
More information about the Python-ideas