1 2 3 4 5 6 7 8 9 10
class A(): def bar(self): print "hi" A.foo = lambda self, x: x a = A() a.foo(5) # 5 del A.foo a.foo(5) # AttributeError: A instance has no attribute 'foo'