Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
The standard library isn't at fault here. Please file this an an LXML bug. Reproducer: from lxml.etree import Element root = Element('outer') root.append(Element('zero')) root.append(Element('one')) root.append(Element('two')) print([e.tag for e in root]) root[1], root[0] = root[0], root[1] print([e.tag for e in root]) This outputs: ['zero', 'one', 'two'] ['one', 'two'] Replacing the import with: from xml.etree.ElementTree import Element Gives the expected result: ['zero', 'one', 'two'] ['one', 'zero', 'two'] ---------- nosy: +scoder -skrah _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43618> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com