One little addition to the elementtree docs. In the overview section, adding a paragraph explaining best practice for importing the module might be useful.
Some suggested text, for the "overview" section: """ The ElementTree module comes in two forms - a pure-python version (xml.etree.ElementTree) and a C-coded implementation (xml.etree.cElementTree) which is faster. To import the faster code if possible, but fall back to the Python implementation, you can use try: from xml.etree import cElementTree as ET except ImportError: from xml.etree import ElementTree as ET ElementTree is also available as an external module for older Python versions. For portability to these versions, this pattern can be extended to try: from xml.etree import cElementTree as ET except ImportError: try: from xml.etree import ElementTree as ET except ImportError: try: import cElementTree as ET except ImportError: import ElementTree as ET """ I'd put a patch on SF, but guess what? It's down again :-( Paul. PS This actually begs the question - are there platforms where xml.etree.cElementTree is not available? If not, is there a need for both versions? If there are, the wording above should probably be modified to reflect this. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com