On 26 juin, 17:18, Allen <[EMAIL PROTECTED]> wrote: > I need a way to add a method to an existing instance, but be as close as > possible to normal instance methods.
def set_method(obj, func, name=None): if not name: name = func.__name__ setattr(obj, name, func.__get__(obj, type(obj))) class Toto(object): pass toto = Toto() def titi(self): print self set_method(toto, titi) -- http://mail.python.org/mailman/listinfo/python-list