Adding bound methods dynamically... CORRECTED

Bruno Desthuilliers bdesth.quelquechose at
Thu Sep 1 23:09:12 CEST 2005

Kevin Little a écrit :

Oops, sorry, forgot to answer

> '''
> I want to dynamically add or replace bound methods in a class. 
> Is there a more pythonic way that's as straight forward?

What's wrong with:

class Foo:

def method(self):
   print "%s" % self

f = Foo()
Foo.method = method

More information about the Python-list mailing list