[Python-Dev] Adding concat function to itertools
djm at mindrot.org
Sat Sep 29 00:09:32 CEST 2007
On Fri, 28 Sep 2007, Raymond Hettinger wrote:
> > Interestingly, they seem to all have something to do with dictionary
> > values() that are themselves iterable.
> I see. These are instances of a recurring general use case of
> chain() as a one-level flattener.
> Will give consideration to changing the signature of chain() for Py3.0.
> Besides the concat() variation using a single iterable input, another
> alternative is the min()/max() style signature where one input is
> interpreted as iterable and multiple arguments as comprising an
> input tuple.
Has anyone considered making the iterator __add__ operator perform
something similar to chain? I.e.
list(a + b) => [ a0, a1, ... an, b0, b1, bn]
(where "a" and "b" are iterables)
More information about the Python-Dev