itertools to iter transition (WAS: Pre-PEP: Dictionary accumulatormethods)

G

Greg Ewing

Steven said:
I'd argue that for the same reasons that
dict.fromkeys is a dict classmethod, the itertools methods could be iter
classmethods (or staticmethods). The basic idea being that it's nice to
place the methods associated with a type in that type's definiton. The
parallel's a little weaker here because calling iter doesn't always
produce objects of type iter:

Indeed, I see iter() as being more like len(), which
is clearly a function, not a constructor. Making iter()
a type and giving it class methods would be strange.
 
G

Greg Ewing

Ville said:
The issue that really bothers me here is bloating the builtin
space. We already have an uncomfortable amount of builtin
functions.

Maybe what we're really after here is the notion of a
builtin module that's pre-imported into the builtin
namespace.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top