What can be iterable

suggest change

Iterable can be anything for which items are received one by one, forward only. Built-in Python collections are iterable:

[1, 2, 3]     # list, iterate over items
(1, 2, 3)     # tuple
{1, 2, 3}     # set
{1: 2, 3: 4}  # dict, iterate over keys

Generators return iterables:

def foo():  # foo isn't iterable yet...
    yield 1

res = foo()  # ...but res already is

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents