First page Back Continue Last page Overview Graphics

Generators

It is possible to write

functions that may be

resumed after they

send a value back.

These functions are

called generators

because they generate

a sequence of values over

time.

The main difference between functions and generators is the generators yield a value instead of returning it, i.e.

a yield statement is used instead of a return statement