[docs] Provide some examples for usage of ElementTree methods/attributes (issue 15586)

eliben at gmail.com eliben at gmail.com
Thu Aug 9 09:44:44 CEST 2012


http://bugs.python.org/review/15586/diff/5683/Doc/library/xml.etree.elementtree.rst
File Doc/library/xml.etree.elementtree.rst (right):

http://bugs.python.org/review/15586/diff/5683/Doc/library/xml.etree.elementtree.rst#newcode40
Doc/library/xml.etree.elementtree.rst:40: .. code-block:: xml
Nice!

http://bugs.python.org/review/15586/diff/5683/Doc/library/xml.etree.elementtree.rst#newcode69
Doc/library/xml.etree.elementtree.rst:69: tree = ET()
Why are you calling the module here? Did you actually execute the
examples? Please make sure all examples execute correctly.

For loading data from the file, use ElementTree's constructor. No need
to invoke the parse method as well.

http://bugs.python.org/review/15586/diff/5683/Doc/library/xml.etree.elementtree.rst#newcode73
Doc/library/xml.etree.elementtree.rst:73: Reading the file from a remote
URL::
I don't think the urllib example belongs here. It's clear that if ET can
build itself from files, streams and strings, than everything that
produces those will work.

http://bugs.python.org/review/15586/diff/5683/Doc/library/xml.etree.elementtree.rst#newcode125
Doc/library/xml.etree.elementtree.rst:125: If a more strict reliance on
tree structure is desired, :meth:`Element.findall`
I'd remove the "if a more strict reliance..." part. I'm not sure what it
means. The findall/find examples are good

http://bugs.python.org/review/15586/


More information about the docs mailing list