From: Günter M. <mi...@us...> - 2022-05-25 19:50:53
|
addendum: in xml.dom, Text nodes compare by instance. --- ** [bugs:#448] `Element.index()` returns incorrect results for `Text` nodes** **Status:** open **Created:** Tue May 24, 2022 11:38 PM UTC by Adam Turner **Last Updated:** Tue May 24, 2022 11:38 PM UTC **Owner:** nobody This captures the bug behind `branches/index-bug`. I'm not sure the general case of `index` is worth fixing, as `Text` nodes are a special case, but it might have implications for `Node.findall`. ```python >>> from docutils import nodes >>> tree = nodes.Element() >>> blah1 = nodes.Text("blah") >>> blah2 = nodes.Text("blah") >>> tree += [nodes.Text("node1"), blah1, blah2] >>> print(tree.pformat()) <Element> node1 blah blah >>> tree[tree.index(blah2)] is blah2 False >>> tree[tree.index(blah2)] is blah1 True ``` A --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |