Can __iter__ be used as a classmethod?

Greg Ewing (using news.cis.dfn.de) me at privacy.net
Wed Mar 12 17:41:33 EST 2003


Alex Martelli wrote:
> what happens if you're multiply inheriting from
> a class C and a class D and both have class methods?  Should
> we have a FURTHER custom metaclass generated then?  Magic
> gets blacker and blacker...

Hmmm, I hadn't considered that. You're right, it could
get messy. (Smalltalk avoids this problem by not having
multiple inheritance. :-)

> What do you find so horrible with classmethod as it stands
> that would come close to justifying such an excursion into
> exhoterism in order to get rid of it?

I don't find them horrible, I was just exploring whether
it was redundant or nearly so, given the metaclass mechanism.
It seemed as though the only extra thing it gave you was
the ability to call class methods through an instance,
which didn't seem startlingly useful to me.

But I can see now that it is better behaved in the
face of multiple inheritance, which is probably a pretty
good justification!

-- 
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