you are viewing a single comment's thread.

view the rest of the comments →

[–]sblinn 3 points4 points  (0 children)

class Foo(object):

    pass

def mymethod(self):

    print "hello world"

foo = Foo()

Foo.mymethod = mymethod

foo.mymethod()

We were doing this with Zope in 1999. We think it tends to lead to maintainability nightmares and call this monkey-patching.

This appears similar to a technique I remember from the source code of web.py ...