[issue34160] ElementTree not preserving attribute order

Ned Batchelder report at bugs.python.org
Sat Nov 10 13:51:35 EST 2018


Ned Batchelder <ned at nedbatchelder.com> added the comment:

Words like flawed from the outset, fundamentally flawed, fragile, and ill-conceived are being thrown around, which does not help the discussion.  Can we focus on the question of whether it's reasonable to add sorted attributes as an option?

This idea exactly parallels the sort_keys option in the json module.  It precisely solves the problem I have.  The code change is small.  I'll even volunteer to make the pull request.

I'm not suggesting that we get rid of the new feature of preserving the user's attributes order. I'm not even suggesting that the new feature needs to be the non-default option. I'd just like a way to sort attributes in XML output.

----------

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


More information about the Python-bugs-list mailing list