[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-08-18 Thread Stefan Behnel
Stefan Behnel added the comment: The can store arbitrary objects sentence is now duplicated, and still way too visible. I have to read three sentences until it tells me what I need to know. -- ___ Python tracker rep...@bugs.python.org

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-08-18 Thread Stefan Behnel
Stefan Behnel added the comment: I think the first two sentences can simply be removed to fix this, without loss of readability or information. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24079

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-08-17 Thread Ned Deily
Ned Deily added the comment: Thanks for all of your contributions on this. I've committed a version along the lines I suggested along with Martin's example. -- resolution: - fixed stage: commit review - resolved status: open - closed type: behavior -

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-08-17 Thread Roundup Robot
Roundup Robot added the comment: New changeset d3cda8cf4d42 by Ned Deily in branch '2.7': Issue #24079: Improve description of the text and tail attributes for https://hg.python.org/cpython/rev/d3cda8cf4d42 New changeset ad0491f85050 by Ned Deily in branch '3.4': Issue #24079: Improve

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-08-12 Thread Robert Collins
Robert Collins added the comment: So it is downplayed but it is still documented as being application usable. I'll give this another week for Ned to reply, then commit it in the absence of a reply: I think its ok as is. I'd be ok with a tweaked version along the lines Ned proposed too: both

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-07-31 Thread Martin Panter
Martin Panter added the comment: I think Ned’s version is an acceptable solution (modulo some punctuation) to the original problem, although I do agree with Stefan that downplaying the generality would be even better. Perhaps we could add a qualifier, like “The *text* attribute [normally]

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-07-31 Thread Stefan Behnel
Stefan Behnel added the comment: could we apply this patch, please? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24079 ___ ___

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-07-31 Thread Ned Deily
Ned Deily added the comment: I note that the current wording for both text and tail are careful to allow for the most general use of the Element class, that is, that it may be used in non-XML contexts, for example: The text attribute can be used to hold additional data associated with the

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-07-31 Thread Stefan Behnel
Stefan Behnel added the comment: The proposed patch downplays that generality. That is completely intentional. Almost all readers of the documentation will first need to understand the difference between text and tail before they can go and think about any more advanced use cases that will

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-07-06 Thread Martin Panter
Changes by Martin Panter vadmium...@gmail.com: -- stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24079 ___ ___

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-06-05 Thread Stefan Behnel
Stefan Behnel added the comment: Looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24079 ___ ___ Python-bugs-list mailing list

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-06-03 Thread Martin Panter
Martin Panter added the comment: Okay, here is a version with most of the wording reverted to Jérôme’s suggestion. I only left my itertext() example, and the grouping of text and tail together. If there are any more bits that are incorrect or unclear please identify them. -- Added

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-05-29 Thread Stefan Behnel
Stefan Behnel added the comment: IMHO less clear and less correct than the previous suggestions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24079 ___

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-05-29 Thread Stefan Behnel
Stefan Behnel added the comment: Seems like a good idea to explain text and tail in one section, though. That makes tail easier to find for those who are not used to this kind of split (and that's basically everyone who needs to read the docs in the first place). --

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-05-12 Thread Martin Panter
Martin Panter added the comment: Another problem with tostring() is that it seems you have to call it with encoding=unicode. Perhaps it would be better to suggest code like .join(element.itertext())? I would also improve on Jérôme’s version by making the None case more explicit. And perhaps

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-04-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: this is well formed xml and has nothing to do with tail. In fact, it does have something to do with tail. The 'TEXT' is a captured as the tail of element b: root3 = ET.fromstring('ab/TEXT/a') root3[0].tail 'TEXT' -- nosy: +eli.bendersky,

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-04-30 Thread Stefan Behnel
Stefan Behnel added the comment: I agree that the wording in the documentation isn't great: text The text attribute can be used to hold additional data associated with the element. As the name implies this attribute is usually a string but may be any application-specific object. If the

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-04-30 Thread Jérôme Laurens
Jérôme Laurens added the comment: Since the text and tail notions seem tightly coupled, I would vote for a more detailed explanation in the text doc and a forward link in the tail documentation. text The text attribute holds the text between the element's begin tag and the next tag or

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-04-30 Thread Jérôme Laurens
Jérôme Laurens added the comment: Erratum def innertext(elt): return (elt.text or '') +''.join(innertext(e)+(e.tail or '') for e in elt) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24079

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-04-30 Thread Jérôme Laurens
Jérôme Laurens added the comment: The totsstring(..., method='text') is not suitable for the inner text because it adds the tail of the top element. A proper implementation would be def innertext(elt): return (elt.text or '') +''.join(innertext(e)+e.tail for e in elt) that can be

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-04-29 Thread Jérôme Laurens
New submission from Jérôme Laurens: The documentation for xml.etree.ElementTree.Element.text reads If the element is created from an XML file the attribute will contain any text found between the element tags. import xml.etree.ElementTree as ET root3 = ET.fromstring('ab/TEXT/a')

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-04-29 Thread Ned Deily
Ned Deily added the comment: (This issue is a followup to your Issue24072.) Again, while the ElementTree documentation is certainly not nearly as complete as it should be, I don't think this is a documentation error per se. The key issue is: with which element is each text string