Wouldn't it be nice if this worked?

Patrick Mullen saluk64007 at gmail.com
Sun Aug 10 15:42:27 EDT 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