Wouldn't it be nice if this worked?

Patrick Mullen saluk64007 at gmail.com
Sun Aug 10 21:42:27 CEST 2008


How about:

class A:
    def add(self,x,y):
        return x+y

class B(A):
    pass

print B().add(1, 2)



This also works:

class A:
   def add(self, x, y):
       return x+y

class B:
   pass

B.add = A.add.im_func
print B().add(1, 2)



More information about the Python-list mailing list