[Python-ideas] iter() on steroids

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 14 03:51:57 CEST 2007


George Sakkis wrote:
> The proposal is to make the the builtin iter() return an object with
> an API that consists of (most) functions currently at itertools.

The problem with this kind of thing is that it
becomes an arbitrary choice what is included as
a method. Anything not included in that choice
is left out in the cold and has to be applied
as a function anyway.

If there were a certain set of iterator algebra
functions that were *very* frequently used,
there could be an argument for making methods
of them. But I think you're overestimating how
much the itertools functions are used. Some
people may make heavy use of them, but they're
not used much in general.

If you happen to be a heavy user, there's
nothing stopping you from creating your own
version of iter() that returns an object with
all the methods you want. Let's keep the
standard iterator objects clean and simple.

--
Greg



More information about the Python-ideas mailing list