MemotivaIterators and iterables

What does the iter function do?

Iterators and iterables

Audio flashcard · 0:16

Nortren·

What does the iter function do?

0:16

The iter function returns an iterator from an iterable. It calls the iterable's dunder iter method. There is also a two-argument form: iter of a callable and a sentinel returns an iterator that calls the callable until it returns the sentinel. This is useful for iterating over file reads or network responses. ---
docs.python.org