xml.dom.minidom + py2exe

Gordon McMillan gmcm at hypernet.com
Fri Jul 20 09:50:30 EDT 2001


Martin von Loewis wrote:

> Gordon McMillan <gmcm at hypernet.com> writes:
> 
>> You have to do a lot more than that. After all, once xml/__init__.py
>> runs and swaps itself for _xmlplus/__init__.py, then xml.sax.expatreader
>> refers to _xmlplus/sax/expatreader.py. 
> 
> The original reporter did not have PyXML installed, so no swapping of
> _xmlplus would happen on this installation.

Never read the original report. I was responding to the text I quoted 
(and you elided). The import hacks in _xmlplus, while clever, make
things difficult, and not just for dependency trackers.

After all, there are 8 places in _xmlplus that do 
"import xml.<something>", and where the intent is not to get
xml/<something>, but to get _xmlplus/<something>. And 297 that
do "from xml.<something> import ..." with the same intent.

So only readers (human or tools) that understand what happens
in xml/__init__.py have a prayer of figuring out what's going on.

PyXML is hardly alone in this. Many package authors indulge in import
hacks, thinking they can make their package more user friendly. In
the long run, though, this kind of import hack is user hostile.

- Gordon



More information about the Python-list mailing list