Any value that can produce iterators is called an iterable value. In Python, an iterable value is anything that can be passed to the built-in iter function. Iterables include sequence values such as strings and tuples, as well as other containers such as sets and dictionaries. Iterators are also iterables, because they can be passed to the iter function.

Even unordered collections such as dictionaries must define an ordering over their contents when they produce iterators. Dictionaries and sets are unordered because the programmer has no control over the order of iteration, but Python does guarantee certain properties about their order in its specification.

TODO block quote

>>> d = {'one': 1, 'two': 2, 'three': 3}
    >>> d
    {'one': 1, 'three': 3, 'two': 2}
    >>> k = iter(d)
    >>> next(k)
    'one'
    >>> next(k)
    'three'
    >>> v = iter(d.values())
    >>> next(v)
    1
    >>> next(v)
    3
    

If a dictionary changes in structure because a key is added or removed, then all iterators become invalid and future iterators may exhibit arbitrary changes to the order their contents. On the other hand, changing the value of an existing key does not change the order of the contents or invalidate iterators.

>>> d.pop('two')
    2
    >>> next(k)
           
    RuntimeError: dictionary changed size during iteration
    Traceback (most recent call last):