Language Syntax

Yield from — Python syntax

Delegate generator iteration to another iterable. A subgenerator's return value becomes the value of the yield-from expression; send and throw are delegated when supported.

Formal Syntax & Structure

python syntaxpython
yield from iterable

Working Example

Example Snippetpython
def part():    yield 2    return 9def all_items():    result=yield from part()    yield resultprint(list(all_items()))
Python Reference