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

2014-04-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: Given Stephan's concerned, I withdraw this feature request. -- resolution: -> not a bug status: open -> closed ___ Python tracker ___ __

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

2014-04-02 Thread Stefan Behnel
Stefan Behnel added the comment: > How about just making a sensibly-behaving __iter__ for ElementTree? Well, the problem is to determine what "sensibly-behaving" is. I can see three options. 1) tree.iter() == tree.getroot().iter() 2) iter(tree.getroot()) 3) iter([tree.getroot()]) The secon

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

2014-04-02 Thread Eli Bendersky
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 t

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

2014-04-02 Thread Stefan Behnel
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 ite

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

2014-04-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: > ElementTree class currently supports that, > using the find*() or iter() methods. That would be great except that ElementTree doesn't actually have an __iter__ method. > Ok, but why? The short answer is that every time I conduct Python training, people

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

2014-04-01 Thread Stefan Behnel
Stefan Behnel added the comment: > Add all the element methods to the elementtree object. Ok, but why? An ElementTree object *is not* an Element. It's a representation of a document that *has* a root Element. It makes sense for a document to allow searches over its content, and the ElementTree

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

2014-03-31 Thread Raymond Hettinger
Raymond Hettinger 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 ro

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

2014-03-31 Thread Eli Bendersky
Eli Bendersky added the comment: Raymond, you are right that the APIs presented by Element and ElementTree are somewhat different. As Stefan mentioned, they were really meant to represent different things, but with time some "convenience" features crept in and made the difference somewhat more

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

2014-03-23 Thread Stefan Behnel
Stefan Behnel added the comment: catalog = xml.etree.ElementTree.parse('books.xml') # This succeeds for book in catalog.findall('book'): print(book.tag) This is a bit of a convenience break in the API. The "normal" way to do it would be either catalog.getroot().findall('book')

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

2014-03-22 Thread Martin Panter
Changes by Martin Panter : -- nosy: +vadmium title: ElementTree objects should support all the same methods are Element objects -> ElementTree objects should support all the same methods as Element objects ___ Python tracker