from types import MethodType class A(object): def m(self): print 'aaa' a = A() def new_m(self): print 'bbb' a.m = MethodType(new_m, a)