Reuse base-class implementation of classmethod?

Giovanni Bajo noway at sorry.com
Mon Oct 31 19:24:37 EST 2005


Hello,

what's the magic needed to reuse the base-class implementation of a
classmethod?

class A(object):
   @classmethod
   def foo(cls, a,b):
       # do something
       pass

class B(A):
    @classmethod
    def foo(cls, a, b):
         A.foo(cls, a, b)   # WRONG!

I need to call the base-class classmethod to reuse its implementation, but I'd
like to pass the derived class as first argument.
-- 
Giovanni Bajo





More information about the Python-list mailing list