[issue34160] ElementTree not preserving attribute order

Julian Sivertsen report at bugs.python.org
Wed Dec 19 09:48:47 EST 2018


Julian Sivertsen <julian.sivertsen+python at gmail.com> added the comment:

I don't understand why this library should go out of its way to support the old behavior when it seems like the only thing it breaks is tests that assume something that was never guaranteed and where you can get the old behavior in just two lines of Python:

for node in root.iter():
    node.attrib = dict(sorted(node.items()))

Kind regards from confused Pythoner that just wonted the attribute order to make sense

----------
nosy: +sivert

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34160>
_______________________________________


More information about the Python-bugs-list mailing list