[Python-3000] Builtin iterator type

Mike Klaas mike.klaas at gmail.com
Tue Nov 14 22:59:36 CET 2006


On 11/14/06, George Sakkis <gsakkis at rutgers.edu> wrote:

> And for those objecting to touching the existing iter() or bloating
> the builtin namespace with yet another builtin, let me mention that we
> can get rid of *two* existing functions which for some reason were
> promoted to builtin status, although they conceptually belong in
> itertools: enumerate and reversed.

Well, "conceptually" all itertools are not equal.  enumerate and
reversed (and let's not forget xrange) are among my most-used
"itertools"--enumerate in particular is used is virtually every
module.  Some tools in itertools also belong to that category--izip in
particular is used heavily in my code.  Some of the heavily-used
itertools are already being pseudo-promoted to builtins: zip, map,
(and maybe? filter) are turning into izip, imap, and ifilter.

I will admit that itertools are among the few modules that are
"first-class" import citizens in my code, that is, I tend to import
the symbols directly:

from itertools import groupby, chain

Another such module is collections.  It is possible that once I'm more
familiar with functools and contextlib that they will occupy this
hallowed place.

I don't see the problem of importing important language functionality.
 Most languages since c have required somthing similar.

-Mike


More information about the Python-3000 mailing list