Wouldn't it be nice if this worked?

Suresh V. suresh_vv at yahoo.com
Sun Aug 10 21:17:14 CEST 2008


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

class B:
     pass

B.add = A.add

print B().add(1, 2) <----- gives TypeError: unbound method add() must
                            be called with A instance as first argument




More information about the Python-list mailing list