Concatenation is the most fundamental operation that can be done on iterators. In fact, we already do that with lists.
[1, 2, 3] + [4, 5, 6]
# evaluates to [1, 2, 3, 4, 5, 6]
I propose:
iter([1, 2, 3]) + iter([4, 5, 6])
# evaluates to something like itertools.chain(iter([1, 2, 3]), iter([4, 5, 6]))
# equivalent to iter([1, 2, 3, 4, 5, 6])
There is some python2 code where:
a = dict(zip('abcd', range(4)))
isinstance(a.values(), list)
alphabet = a.keys() + a.values()
In python2, this `alphabet` becomes a list of all values and keys
In current python3, this raises:
TypeError: unsupported operand type(s) for +: 'dict_keys' and 'dict_values'
But in my proposal, it works just fine. `alphabet` becomes an iterator over all values and keys (similar to the python2 case).