Today we had to patch a class function in production. Monkey patching can become tricky if reference are kept at several place like pointer in C and C++.Share on Reddit!!!
Here is a simple example on how to make sure all references will use the new definition.class Foo:This is another reason why interpreter language like python are so powerful.
print "default f"
Foo.f.im_func.func_code = newf.func_code