[issue21028] ElementTree objects should support all the same methods as Element objects

Stefan Behnel report at bugs.python.org
Wed Apr 2 09:45:49 CEST 2014


Stefan Behnel added the comment:

> I don't see any benefit from having this code fail:
> 
>     from xml.etree.ElementTree import parse
> 
>     catalog = parse('books.xml')
>     for book in catalog:
>         print book.get('id')

Why would you expect it to work? And how?

Why would it only iterate over the *children* of the root Element that it
wraps, and not yield the root Element itself, and maybe any preceding or
following processing instructions or comments, the doctype declaration, etc.?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21028>
_______________________________________


More information about the Python-bugs-list mailing list