[issue34160] ElementTree not preserving attribute order

Stefan Behnel report at bugs.python.org
Sat Mar 16 17:18:50 EDT 2019


Stefan Behnel <stefan_ml at behnel.de> added the comment:

Ned, would it solve your problem to write a helper function that walks the tree and sorts the attrib dicts? That would also work in all existing CPython versions (because they already sort attributes anyway), for both ElementTree and lxml, and you wouldn't have to pass a new option into the serialiser conditionally based on the running Python version.

----------

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


More information about the Python-bugs-list mailing list