Codice:
>>> class c:
... def f(self): print 'f!'
>>> a = c()
>>> a.f()
f!
>>> def g(self):
... print 'g!'
>>> c.g = g
>>> a.g()
g!
>>> def h(x):
... print 'x:', x
>>> a.h = h
>>> a.h(1)
x: 1
>>> b = c()
>>> b.h(1)
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
b.h(1)
AttributeError: c instance has no attribute 'h'
>>> del c.f
>>> a.f()
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
a.f()
AttributeError: c instance has no attribute 'f'