AI engineering glossary · Python advanced

What is yield from?

yield from: A statement that delegates to another iterable or generator, yielding each of its values in turn and passing back its return value. It simplifies chaining generators and was a stepping stone towards async syntax.

Level: advancedTopic: Python advanced

yield from: an example

def flatten(lists): for sub in lists: yield from sub produces every item from every inner list.

Related terms

More Python advanced terms

Where you learn it

yield from is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.