[lxml-dev] Is it bug?
Hello! I discover some counterintuitive behavior of 'tail' attribute: >>> from lxml import etree >>> a = etree.XML('<a><b>text</b>tail</a>') >>> b = a[0] >>> print b.tail tail >>> a[:] = [] >>> print b.tail None # EXPECTED: tail I think, it is bug or at least worth note in documentation Thank you for the great library, anyway! :) -- Best regards, Alexander mailto:alexander.kozlovsky@gmail.com
Hi, Alexander Kozlovsky wrote:
I discover some counterintuitive behavior of 'tail' attribute:
>>> from lxml import etree >>> a = etree.XML('<a><b>text</b>tail</a>') >>> b = a[0] >>> print b.tail tail >>> a[:] = [] >>> print b.tail None # EXPECTED: tail
I think, it is bug or at least worth note in documentation
Definitely looks like a bug to me. The tail should stay with the unlinked element. Thanks for the report, I'll look into this.
Thank you for the great library, anyway! :)
:) Stefan
Hi, Stefan Behnel wrote:
Alexander Kozlovsky wrote:
I discover some counterintuitive behavior of 'tail' attribute:
>>> from lxml import etree >>> a = etree.XML('<a><b>text</b>tail</a>') >>> b = a[0] >>> print b.tail tail >>> a[:] = [] >>> print b.tail None # EXPECTED: tail
I think, it is bug or at least worth note in documentation
Definitely looks like a bug to me. The tail should stay with the unlinked element. Thanks for the report, I'll look into this.
Here's a patch, applied against the current trunk (applying it against 1.3beta should also work). Stefan
participants (2)
-
Alexander Kozlovsky -
Stefan Behnel