I just noticed the existence of zope.etree. Besides a minor comment on
its use of 'zope' as the namespace package, which I believe is generally
reserved for core components, I have the following more conceptual comment:
There are currently three implementations of the ElementTree API:
ElementTree (original implementation in plain Python)
cElementTree (same API, faster, C-code)
lxml.etree (same API but vastly extended, faster, dependency on
The motivation of zope.etree appears to be to be able to swap out
ElementTree with lxml for performance reasons. While as the developer of
lxml the increased use of lxml makes me happy, I still wonder why this
choice was made. Glancing through the code I cannot find a reference to
cElementTree at all. I wonder why the choice wasn't made to simply swap
out with cElementTree instead?
After all, the reason to do this, as stated, is performance.
cElementTree has performance, is easier to install than lxml (as it
doesn't have dependencies), will ship with Python 2.5, and has the same
API as ElementTree itself.
The main reason to use lxml over cElementTree is not performance
(sometimes it's faster, sometimes slower, depending on what you do) but
is extended features - lxml has a huge featureset. Some of these
features can of course also help with performance, but only if you use
More features cannot be the reason for zope.etree however, as the whole
point is to use lxml and ElementTree interchangably, right?
Zope3-dev mailing list