[issue34160] ElementTree not preserving attribute order

Raymond Hettinger report at bugs.python.org
Sat Mar 16 18:46:24 EDT 2019


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> Raymond, it sounds like your end-user didn't agree that
> "sorting is no longer necessary or desirable."

Sorry for being unclear.  The user needed to *overcome* the sorting behavior so that they could produce an ordering of their own choosing.  The problem then became that we had to work out a way to defeat the sorting to allow the requested attribute ordering to be preserved.

Roughly:

   casefile = Element('casefile', clearance="confidential",
              access="internal", valid_through="31 Mar 2022")

The desired result is that the attribute order be preserved.  By removing the sort, a user can specify an order they want and have that specification honored.

----------

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


More information about the Python-bugs-list mailing list