[issue24724] Element.findall documentation misleading

2019-08-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Issue is closed as far as I'm concerned Me too. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___

[issue24724] Element.findall documentation misleading

2015-08-01 Thread Eric S
Eric S added the comment: Code was intended as example, not request for help to correct, but rushed so example was flawed, but still, I tested and you both are right. Must've had other error in code to cause the xml to dict to have every element map to under every node. Debugger also showed fi

[issue24724] Element.findall documentation misleading

2015-07-31 Thread Martin Panter
Martin Panter added the comment: Eric: Calling findall("country") does _not_ return grandchidren nor further descendants. Also, your pseudocode calling findall() with no arguments does not work, so I am left wondering where you got the wrong impression about grandchildren. The usual way to get

[issue24724] Element.findall documentation misleading

2015-07-31 Thread Stefan Behnel
Stefan Behnel added the comment: Whenever you feel a need for using range(len(...)), you are almost always doing something wrong. The problem in your code is that you are modifying the tree while iterating over it. However, please ask this question on the mailing list as the bug tracker is not

[issue24724] Element.findall documentation misleading

2015-07-31 Thread Eric S
Eric S added the comment: To my preference, the drop-in is verbose and I got a little confused on first read. The current documentation and example seem mostly OK to me. If we leave "children" as in "all children of *root*", it doesn't illuminate the fact that if root had a great-great-grand

[issue24724] Element.findall documentation misleading

2015-07-30 Thread Stefan Behnel
Stefan Behnel added the comment: Here's a complete drop-in replacement. """ More specific constraints on which elements to look for and where to look for them in the tree can be expressed in :ref:`XPath `. :meth:`Element.iterfind` iterates over all elements matching such a path expression.

[issue24724] Element.findall documentation misleading

2015-07-30 Thread Martin Panter
Martin Panter added the comment: How about something like: ''' :meth:`Element.findall` finds all elements matching a path expression; in this example, all children of *root*. meth:`Element.find` finds the *first* matching element, in this example the first child. . . . ''' Also, perhaps it

[issue24724] Element.findall documentation misleading

2015-07-30 Thread Eric S
Eric S added the comment: Pointing to XPath and clarifying the example reference are good ideas. For me though, the phrase "direct children" would still lead me to believe that findall() would only give me the first generation right below the element (e.g. only the countries in the example),

[issue24724] Element.findall documentation misleading

2015-07-27 Thread Stefan Behnel
Stefan Behnel added the comment: Agreed that it's misleading. Note that the section refers to the *following* example, not the one that readers just went through. I would actually start that paragraph with the reference to XPath (because that's the difference to el.iter()), and then just prese

[issue24724] Element.findall documentation misleading

2015-07-25 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- keywords: +patch Added file: http://bugs.python.org/file40026/etree_clarify.diff ___ Python tracker ___

[issue24724] Element.findall documentation misleading

2015-07-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: The phrase occurs in https://docs.python.org/3/library/xml.etree.elementtree.html#finding-interesting-elements I think it should say, "In this example, Element.findall() finds only elements with a tag which are direct children of the current element." Late

[issue24724] Element.findall documentation misleading

2015-07-25 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- components: +Documentation nosy: +eli.bendersky, scoder ___ Python tracker ___ ___ Python-bugs-list

[issue24724] Element.findall documentation misleading

2015-07-25 Thread Eric S
New submission from Eric S: Documentation states: Element.findall() finds only elements with a tag which are direct children of the current element. More accurate to say "direct descendents" as "direct children" implies only one generation below whereas function goes down to all g...children.