Changing base class of a big hierarchy
John J. Lee
jjl at pobox.com
Mon Aug 4 14:04:28 CEST 2003
bokr at oz.net (Bengt Richter) writes:
> On 03 Aug 2003 12:31:37 +0100, jjl at pobox.com (John J. Lee) wrote:
> >I'm trying to change a base class of a big class hierarchy. The
> >hierarchy in question is 4DOM (from PyXML). 4DOM has an FtNode class
> >that defines __getattr__ and __setattr__ that I need to override.
> If FtNode lived in a separate module that was imported, could you
> import an impostor module which would override subsequent imports?
That's a tempting idea, but is it possible (without a lot of work) to
do it *without* ending up with sys.modules containing my hacked
FtNode? I don't want my hacked class hierarchy to infect other
peoples code that innocently imports xml.dom.
How would you go about it?
More information about the Python-list