Generators

Download python eBook

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

Stats

3770 Contributors: 55
Monday, July 10, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook