Working towards retiring PyXML

Nick Coghlan ncoghlan at redhat.com
Fri Jul 27 02:27:31 UTC 2012


On 07/27/2012 07:28 AM, David Malcolm wrote:
> With my proposed approach, you have to opt-in, your code can say: when I
> say "xml", I really mean "xml", not "_xmlplus".

You can do much the same thing at the application level without patching
the stdlib:

import xml
xml.__path__.reverse() # If both are available, prefer stdlib over PyXML

The key point is to keep both path fragments, and just rearrange the
order so the standard lib if first. That way the PyXML-only stuff will
still be accessible, but the stdlib will be preferred for any name
conflicts in package level components that get imported after the path
reversal.

Cheers,
Nick.

-- 
Nick Coghlan
Red Hat Infrastructure Engineering & Development, Brisbane


More information about the python-devel mailing list