[Python-3000] Builtin iterator type

Jim Jewett jimjjewett at gmail.com
Tue Nov 14 19:06:12 CET 2006


On 11/14/06, George Sakkis <george.sakkis at gmail.com> wrote:

> This is the python-3000 list; I don't aim at Python 2.x. Given that I
> propose to *replace* itertools, not add an extra builtin (having them
> both would be redundant and violates the one obvious way to do it
> principle), it wouldn't be backwards compatible. As for the -1s, so
> far most of them seem to oppose the inheritance idea as a worse option
> than duck typing; let's see if removing this part changes anything.

Yes, and at first glance, an IterMixin would be nice.  But only at first glance.

(1)  Things that are already iterators won't implement the entire
newly expanded iteration API.   I don't want people to start
mechanically replacing

    for var in seq

with

    for var in Iter(seq)

just because they can't remember whether or not it matters.

(2)  Some of the functionality in itertools (particularly islice) is
awkward enough that maybe it should be hidden in a library.  That way
people are less likely to stumble on it without seeing the
documentation.

(3)  IterMixin would be the only mixin exposed as a builtin -- the
other mixins must be imported.  The builtin type factories are
typically the stripped down versions.

-jJ


More information about the Python-3000 mailing list