Can __iter__ be used as a classmethod?

Michael Hudson mwh at python.net
Tue Mar 11 08:39:30 EST 2003


"Greg Ewing (using news.cis.dfn.de)" <me at privacy.net> writes:

> Alex Martelli wrote:
> > Aren't these reasons enough?  How else would you code a method that
> > you can indifferently call either on any instance or on the class
> > object itself?
> 
> How often do people actually *need* that functionality, though?

I've done it, but I can't remember why :-)

> Can someone provide a compelling use case for this in Python?

Depends what you mean by "compelling" of course.  I see little harm in
having them.

Cheers,
M.

-- 
  The meaning of "brunch" is as yet undefined.
                                             -- Simon Booth, ucam.chat




More information about the Python-list mailing list