Dynamically removing methods in new-style classes

Michele Simionato michele.simionato at gmail.com
Wed Sep 12 10:54:34 EDT 2007


On Sep 12, 4:28 pm, agupta0... at gmail.com wrote:
> I am trying unsuccessfully to remove some methods from an instance,

Usuall one does not remove methods, but wraps the object and delegates
only to
a restricted number of methods. Is this solution viable? If not, you
may be
forced to change the class of the instance, or to play trick such as

def removed_method(self):
   raise NotImplementedError

self.test1 = removed_method.__get__(self)

          Michele Simionato




More information about the Python-list mailing list