Why ElementTree

From Creative Commons
Revision as of 01:15, 9 February 2006 by Nathan Yergler (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

As of 8 Feburary 2006, CcPublisher has discarded libxml2/libxslt in favor of ElementTreefor XML and XPath manipulations. While libxml2 is a high-speed, memory efficient XML engine, there are a few reasons for this switch.

  • Unless there are large performance gains, we prefer pure-Python code over C extensions. Pure Python code is simply easier to deal with when packaging ccPublisher. ElementTree is implemented as pure Python, with a C implementation available in the event that performance does become an issue.
  • As of Python 2.6, ElementTree will be included in the standard library.
  • libxml2 and libxslt have Python bindings, but they are not memory managed.
  • The amount of XML parsing done by the P6 framework is miniscule, so the pain of doing our own memory management and requiring a C extension module is not worth the performance increase.