[issue20198] xml.etree.ElementTree.ElementTree.write attribute sorting

Karthikeyan Singaravelan report at bugs.python.org
Mon Nov 12 00:49:51 EST 2018


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

dictionary's insertion order is preserved in 3.6 and above. Hence sorting by lexical order was removed in issue34160 and there is a discussion in the same issue to add an option to provide sorted output.

As part of triaging I propose closing this issue since the changes were made in issue34160.

$ ./python.exe
Python 3.8.0a0 (heads/master:cd449806fa, Nov 12 2018, 09:51:24)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree.ElementTree import Element, tostring
>>> from collections import OrderedDict
>>> e = Element("tag", OrderedDict([("a", "a"), ("c", "c"), ("b", "b")]))
>>> tostring(e)
b'<tag a="a" c="c" b="b" />'
>>> e = Element("tag", dict([("a", "a"), ("c", "c"), ("b", "b")]))
>>> tostring(e)
b'<tag a="a" c="c" b="b" />'

----------
nosy: +xtreak

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


More information about the Python-bugs-list mailing list