[Python-Dev] elementtree in stdlib (original) (raw)

Martijn Faassen faassen at infrae.com
Thu Apr 6 19:21:52 CEST 2006


Alex Martelli wrote:

On Apr 5, 2006, at 8:30 PM, Greg Ewing wrote:

A while ago there was some discussion about including elementtree in the std lib. I can't remember what the conclusion about that was, but if it does go ahead, I'd like to suggest that it be reorganised a bit. I've just started playing with it, and having a package called elementtree containing a module called ElementTree containing a class called ElementTree is just too confusing for words! Try the 2.5 alpha 1 just released, and you'll see that the toplevel package is now xml.etree. The module and class are still called ElementTree, though.

Note that lxml (which implements an ElementTree compatible API on top of libxml2) was using the 'etree' as a module (not a package name) before this move of ElementTree in the core. I had some discussions with Fredrik about making ElementTree in the Python core consistent with lxml, but no luck there.

I.e., this in ElementTree:

from elementtree.ElementTree import Element

is this in lxml:

from lxml.etree import Element

and I believe in python 2.5 it's now:

from xml.etree.ElementTree import Element

which is not good in my opinion... (though also not a disaster)

Regards,

Martijn



More information about the Python-Dev mailing list