[issue21028] ElementTree objects should support all the same methods as Element objects
Eli Bendersky
report at bugs.python.org
Wed Apr 2 15:32:10 CEST 2014
Eli Bendersky added the comment:
> Do you have concrete suggestions? Make the tree iterable?
> > Add all element methods to the tree, implicitly forwarding to the root?
>
> Yes, that is the feature request. Add all the element methods to the
> elementtree object.
>
> Implicitly forwarding to the root would be a reasonable way to do it, but
> that is just an implementation detail.
Porting over all methods of Element to ElementTree sounds like an overkill
to me. How about just making a sensibly-behaving __iter__ for ElementTree?
This should be easy because ElementTree already has a iter() method that
behaves as needed (goes over all elements including root). Would iteration
+ perhaps clearer documentation solve most of the problem?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21028>
_______________________________________
More information about the Python-bugs-list
mailing list