Python LanguageGenerators

Download Python Language for free

Introduction

Generators are lazy iterators created by generator functions (using yield) or generator expressions (using (an_expression for x in an_iterator)).

Syntax

  • yield <expr>
  • yield from <expr>
  • <var> = yield <expr>
  • next(<iter>)

Related Examples

Introduction