[Python-3000] Builtin iterator type
george.sakkis at gmail.com
Tue Nov 14 19:19:17 CET 2006
On 11/14/06, Jim Jewett <jimjjewett at gmail.com> wrote:
> 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
> for var in Iter(seq)
> just because they can't remember whether or not it matters.
Short answer: it doesn't. Only if you actually use the new API it matters, e.g.
for var in Iter(it1) + Iter(it2):
> (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
You can argue the same for a gazillion other python features. There's
no way to know that list slicing returns a copy and not a view, or
that numpy arrays do the opposite, without reading the docs.
> (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.
That problem is solved if we boost up the existing iter() builtin.
More information about the Python-3000