An object is iterable if it returns an iterator when its iter method is invoked. Iterable values represent data collections, and they provide a fixed representation that may produce more than one iterator.
    For example, an instance of the Letters class below represents a sequence of consecutive letters. Each time its iter method is invoked, a new LetterIter instance is constructed, which allows for sequential access to the contents of the sequence.

    1. >>> class Letters:
    2. def __init__(self, start='a', end='e'):
    3. self.start = start
    4. self.end = end
    5. def __iter__(self):
    6. return LetterIter(self.start, self.end)

    The built-in iter function invokes the iter method on its argument. In the sequence of expressions below, two iterators derived from the same iterable sequence independently yield letters in sequence.

    1. >>> b_to_k = Letters('b', 'k')
    2. >>> first_iterator = b_to_k.__iter__()
    3. >>> next(first_iterator)
    4. 'b'
    5. >>> next(first_iterator)
    6. 'c'
    7. >>> second_iterator = iter(b_to_k)
    8. >>> second_iterator.__next__()
    9. 'b'
    10. >>> first_iterator.__next__()
    11. 'd'
    12. >>> first_iterator.__next__()
    13. 'e'
    14. >>> second_iterator.__next__()
    15. 'c'
    16. >>> second_iterator.__next__()
    17. 'd'

    The iterable Letters instance b_to_k and the LetterIter iterator instances first_iterator and second_iterator are different in that the Letters instance does not change, while the iterator instances do change with each call to next (or equivalently, each invocation of next). The iterator tracks progress through sequential data, while an iterable represents the data itself.
    Many built-in functions in Python take iterable arguments and return iterators. The map function, for example, takes a function and an iterable. It returns an iterator over the result of applying the function argument to each element in the iterable argument.

    1. >>> caps = map(lambda x: x.upper(), b_to_k)
    2. >>> next(caps)
    3. 'B'
    4. >>> next(caps)
    5. 'C'