Search notes:
Python: iterator
An iterator might be created by a
generator
, or functions like
map
,
filter
or
iter
and functions that use the
yield
statement.
.
Relation to iterables
An iterator is an
object
with an
__iter__
and a
__next__
method.
The presence of the
__iter__
method makes the iterator also an an
iterable
. However, an iterable is not necessarily an iterator.
See also
Example: create an arbitrary number of fibonacci numbers
The built in function
iter
and The built in function
next
.
The
itertools
standard library.
Index