Generators
all generators are also iterators
an iterator created automatically by calling a generator function
contains the keyword
yield
anywhere in the bodyWhen a generator function is called, it returns a generator instead of going into the body of the function.
The only way to go into the body of a generator function is by calling next on the returned generator
Yielding values is the same as returning, except yield remebers where it left off
yield from
statement yields all values from an iterable (shortcut) - same asfor x in a
Last updated