Changing base class of a big hierarchy

John J. Lee jjl at pobox.com
Sun Aug 3 18:44:52 EDT 2003


mis6 at pitt.edu (Michele Simionato) writes:
[...]
> Here is a hack that does the job (notice the word 'hack').
> Suppose you have a module called x.py:
[...]
> def modulesub(s,r,module):
[...code generation hack snipped...]
> import x
> Bsource=inspect.getsource(x.B)
> Bnewsource=inspect.getsource(B)
> 
> x=modulesub(Bsource,Bnewsource,x) # redefine the module
[...]

I agree with you that it's a hack ;-).


John




More information about the Python-list mailing list