Can __iter__ be used as a classmethod?

Michele Simionato mis6 at pitt.edu
Thu Mar 13 12:36:05 EST 2003


Alex Martelli <aleax at aleax.it> wrote in message news:<Vnmba.39560$pG1.953261 at news1.tin.it>...
> Greg Ewing (using news.cis.dfn.de) 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...
> 
> 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?
> 
> 
> Alex

You have a point here. Not that I would be opposed to automatic generation
of metaclasses (in some future version of Python, maybe), but it is true that
for the time being classmethods are a much simpler solution. Still, I would
prefer to have them in the standard library, but this is a matter of
personal taste. I agree that this point on multiple inheritance is a quite
strong argument for using them over metamethods.

                                                      Michele




More information about the Python-list mailing list