itertools to iter transition (WAS: Pre-PEP: Dictionary accumulator methods)
Greg Ewing
greg at cosc.canterbury.ac.nz
Fri Apr 1 00:01:20 EST 2005
Steven Bethard wrote:
> 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.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list