Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

Attributes are sorted by name when converted an element to the text 
representation for making it stable. Changing this may break existing software.

I think it makes sense now to add an optional keyword-only parameter sort_attrs 
(True by default) for functions tostring() and tostringlist() and method 
ElementTree.write(). If it is False, attributes will keep the original order.

Since dump() is used for debugging only, it could change the behavior by 
default, even in maintained releases. But currently it just uses 
ElementTree.write(), which should sort attributes by default for compatibility.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34160>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to