[XML-SIG] Finding _xmlplus in Python 2.3a2

Martin v. L÷wis martin@v.loewis.de
04 Mar 2003 08:00:51 +0100

John J Lee <jjl@pobox.com> writes:

> When I use a Python core module, and then install a related third-party
> module (no matter if it's written by the same people, and/or covers very
> similar ground), I don't expect it to clobber the first module unless I
> explicitly ask for that (by using try / except, or manipulating sys.path
> and the module system myself).  I expect it not to even touch the first
> module, actually.  And I would be correct, for all cases EXCEPT PyXML.

No, you wouldn't. There are many cases where installing a new Python
package can modify the behaviour of existing Python modules:

1. Any package can install a .pth file, extending sys.path. This, in
   turn, can cause imports to be resolved in a different way. For this
   change in behaviour, you don't even have to *use* the installed

2. A module can install additional codecs, causing changes in
   behaviour to unicode_string.encode(), and codecs.lookup().

3. A module can register things in copy_reg, causing changes in
   behaviour to the pickle, cPickle, and copy modules.

There are probably more examples, but this "silently augment" approach
is wide-spread in Python (and, indeed, in the world of computing: any
kind of plug-in, by nature, silently extends the behaviour of the
application it is plugged into).