Chaning instance methods

Darrell news at dorb.com
Thu Apr 8 17:34:52 EDT 1999


> To make a long story short, what you're trying to do is not very cool,
> so perhaps you don't get truly cool answers, but still, you can do it
> in Python. Fortunately, what you're asking here is not common practice,
> I hope!

Is this a truly flawed design pattern ?
I have done this for a module  to replace a function with out changing the
module its self. Because I didn't control that module. Also for a class once
to allow a runtime XML type script to replace a method. Both of these can be
tricky to debug because you tend to forget what's happening. Yet a better
solution doesn't come to mind.

Possibly the module problem could be solved by creating another module and
"from XXX import *" then add my replacement function.

Darrell Gallion






More information about the Python-list mailing list