[Python-Dev] Is XML serialization output guaranteed to be bytewise identical forever?
Le lun. 18 mars 2019 ? 23:41, Raymond Hettinger
<raymond.hettinger at gmail.com> a ?crit :
> The code in the current 3.8 alpha differs from 3.7 in that it removes attribute sorting and instead preserves the order the user specified when creating an element. As far as I can tell, there is no objection to this as a feature.
By the way, what's the rationale of this backward incompatible change?
I found this short message:
"FWIW, this issue arose from an end-user problem. She had a hard
requirement to show a security clearance level as the first attribute.
We did find a work around but it was hack."
It's the first time that I hear an user asking to preserve attribute
insertion order (or did I miss a previous request?). Technically, it
was possible to implement the feature earlier using OrderedDict. So
why doing it now?
Is it really worth it to break Python backward compatibility (change
the default behavior) for everyone, if it's only needed for few users?
> 1) Revert back to the 3.7 behavior. This of course, makes all the test pass :-) The downside is that it perpetuates the practice of bytewise equality tests and locks in all implementation quirks forever. I don't know of anyone advocating this option, but it is the simplest thing to do.
Can't we revert Python 3.7 behavior and add a new opt-in option to
preserve the attribution insertion order (current Python 3.8 default
Python 3.7, sorting attributes by name, doesn't sound so silly to me.
It's one arbitrary choice, but at least the output is deterministic.
And well, Python is doing that for 20 years :-)
> 4) Fix the tests in the third-party modules (...)
I also like the option "not break the backward compatibility" to not
have to fix any project :-)
Night gathers, and now my watch begins. It shall not end until my death.