Raymond Hettinger <[email protected]> added the comment:
Interestingly, this isn't an LXML bug. It is a documented difference from how
the standard library works:
https://lxml.de/tutorial.html#elements-are-lists
So, if you want use random.shuffle(), you need the standard library ElementTree
instead of lxml.
This:
from lxml.etree import Element
root = Element('outer')
root.append(Element('zero'))
root.append(Element('one'))
root.append(Element('two'))
root[0] = root[1]
print([e.tag for e in root])
Produces:
['one', 'two']
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43618>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com