[Python-ideas] Use the plus operator to concatenate iterators
Paul Moore
p.f.moore at gmail.com
Wed Aug 5 16:16:28 CEST 2015
On 5 August 2015 at 15:00, Sven R. Kunze <srkunze at mail.de> wrote:
> 60% of the thread are about the ominous * operator on lists. << Seriously?
> The thread started with a simple and useful idea; not with some rarely used
> feature.
> 35% of the thread are about some internal implementation issues. <<< Maybe
> not easy but I am certain you will sort that out.
> 5% about its usefulness and simplicity. <<< I stick to that.
There is no single iterator type that can have a "+" operator defined
on it. If you pick one or more such types, other (possibly user
defined) types will not work with "+" and this will confuse users.
itertools.chain is available to do this in an unambiguous and
straightforward manner, its only downside (for some people) is that
it's slightly more verbose.
Paul
More information about the Python-ideas
mailing list