Changing base class of a big hierarchy

Bengt Richter bokr at oz.net
Mon Aug 4 05:34:16 EDT 2003


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?

If it's all one big file, I guess that won't work, but maybe it would
be a way to factor the problem if you have to do surgery anyway.
Maybe base classes should always come from separate modules, and have
a convention for precomposing the mix before importing the main app
and running that. Just a casual idea, don't know what it'll look like
the morning ;-P

Regards,
Bengt Richter




More information about the Python-list mailing list