[Python-3000] Builtin iterator type

George Sakkis george.sakkis at gmail.com
Tue Nov 14 08:03:08 CET 2006


On 11/13/06, Guido van Rossum <guido at python.org> wrote:

> On 11/13/06, George Sakkis <george.sakkis at gmail.com> wrote:
> > I honestly fail to understand your current objections. Is my analogy
> > with dictmixin flawed ? Would anything change if I named it
> > "itermixin" instead of iter or Iter ? I'm ok with the idea being
> > rejected, but at least I'd like to understand the reasons.
>
> The flaw is that you're creating two categories of iterators: those
> that support the various methods you're adding, and those that don't.
> This means that the itertools module can't be discarded, because it is
> still needed to support those operations for the iterators that don't
> have them natively. Thus, you're introducing two ways of doing the
> same thing -- using itertools (works for all iterators) or using the
> methods (only works for iterators that inherit from your base class).

Understood. Any _technical_ reasons then why shouldn't all iterators
inherit from it, or "duck typing is The Right Way" should be taken as
an axiom ? Why do we somehow _need_ itertools when we don't need
sequencetools, mappingtools, etc ? What's so special about the
iterator protocol ?

George


More information about the Python-3000 mailing list