On Tue, Aug 4, 2015 at 8:43 PM, Joseph Jevnik <joejev@gmail.com> wrote:
Iterators all all different types though. iter(list) returns a list_iterator type, iter(dict.keys()) returns a dict_keys_iterator type and so on. Is your suggestion that the standard lib types do this? How do we update all of the existing iterators not in the stdlib that do not do this?
In theory, this can be done inside PyNumber_Add(x, y). It already checks for numbers or sequences and failing that can check for the __next__ method on its first operand and return itertools.chain(x, y).
Finally, how is this better than itertools.chain?
Shorter. Especially when you chain more than two iterators. Nevertheless, I am -1 on the idea. It is bad enough that Python abuses + as sequences concatenation operator.