A backport of yield from
from Python 3 to Python 2.7.
For more information, see https://github.com/hchasestevens/hchasestevens.github.io/blob/master/notebooks/backporting-yield-from-to-python-27.ipynb
pip install yield-from
>>> from yieldfrom import yield_from, rewrite_yield_from
>>> def inner():
... yield 'inner'
...
>>> @rewrite_yield_from
... def outer():
... yield 'outer start'
... yield_from(inner())
... yield 'outer end'
...
>>> list(outer())
['outer start', 'inner', 'outer end']
- Name: H. Chase Stevens
- Twitter: @hchasestevens