extending an existing class without inhertance

Martin Schmettow martin.schmettow at bibliothek.uni-regensburg.de
Tue Jan 7 11:24:39 EST 2003


Hi anybody.

I am working on a script which uses several XML techniques (building 
DOM,XSLT).
For building the DOM I started using the xml.dom module. This module 
implements the setAttribute() method on element nodes.
For some reasons I have to switch to the Ft.Xml.Domlette implementation, 
where the setAttribute() is missing.
Extending the class by inheritance is obvious but seems not practical in 
this case, because a lot is done by Factories, which you cant just tell 
to produce MyElement instead of Element.
The easiest solution would be to enhance the existing class by just 
adding the method. I did this several times in Perl (in a former life, 
of course).
Can anybody tell me the Python way to do it. Other solutions are welcome 
  as well.

CU
Martin.





More information about the Python-list mailing list