Swapping superclass from a module
manu3d at gmail.com
Sat May 16 18:55:39 CEST 2009
let's assume I have a module with loads of classes inheriting from one
class, from the same module, i.e.:
In a separate file I also have:
Now, let's also assume that myFile.py cannot be changed or it's
impractical to do so. Is there a way to replace the SuperClass at
runtime, so that when I instantiate one of the subclasses
NewSuperClass is used instead of the original SuperClass provided by
the first module module?
That was the generic case. Would the solution change much if
NewSuperClass was actually inheriting from SuperClass, effectively
wedging itself between the SuperClass and the SubClasses?
More information about the Python-list