[Python-Dev] ElementTree in stdlib

Guido van Rossum guido at python.org
Tue Dec 13 05:52:55 CET 2005

On 12/12/05, skip at pobox.com <skip at pobox.com> wrote:
>     Martin> It's difficult to establish precise numbers, but I would expect
>     Martin> that most readers of xml-sig are well aware of how DOM and SAX
>     Martin> work, perhaps even better than ElementTree.
> Perhaps the corollary is that people who are not xml-sig readers will likely
> be put off by DOM and SAX.  I couldn't tell you what they do, just that they
> were Too Hard (tm) for me to bother with XML in most situations.  Then
> ElementTree came along.

It seems pretty clear why DOM isn't Pythonic: it doesn't use Python's
standard APIs for things that conceptually are "just" lists and dicts,
or at least sequences and mappings. Also, the memory footprint is a
bit outlandish.

I don't think that SAX is unpythonic, but it's pretty low-level and
mostly of use to people writing higher-level XML parsers (my parsexml
module uses it).

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list