Victor Stinner schrieb am 21.03.19 um 01:22: > Alternatives have been proposed like a recipe to sort node attributes > before serialization, but honestly, it's way too complex.
Hm, really? Five lines of simple and obvious Python code, that provide a fast and completely Python-version agnostic solution to the problem that a few users have, are "way too complex" ? That sounds a bit extreme to me. > I don't want > to have to copy such recipe to every project. Add a new function, > import it, use it where XML is written into a file, etc. Taken alone, > maybe it's acceptable. But please remember that some companies are > still porting their large Python 2 code base to Python 3. This new > backward incompatible gets on top of the pile of other backward > incompatible changes between 2.7 and 3.8. > > I would prefer to be able to "just add" sort=True. Don't forget that > tests like "if sys.version >= (3, 8):" will be needed which makes the > overall fix more complicated. Yes, exactly! Users would have to add that option *conditionally* to their code somewhere. Personally, I really dislike having to say "if Python version is X do this, otherwise, do that". I prefer a solution that just works. There are at least four approaches that generally work across Python releases: ignoring the ordering, using C14N, creating attributes in order, sorting attributes before serialisation. I'd prefer if users picked one of those, preferably the right on for their use case, rather than starting to put version specific kludges into their code. Stefan _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com