On Mon 12/16/19, 9:59 AM, "David Mertz" 
<me...@gnosis.cx<mailto:me...@gnosis.cx>> wrote:
Admittedly, I was only lukewarm about making an insertion-order guarantee for 
dictionaries too.  But for sets I feel more strongly opposed.  Although it 
seems unlikely now, if some improved implementation of sets had the accidental 
side effects of making them ordered, I would still not want that to become a 
semantic guarantee.

Eek… No accidental side effects whenever possible, please. People come to rely 
upon them (like that chemistry paper example[*]), and changing the assumptions 
results in a lot of breakage down the line. Changing the length of AWS 
identifiers (e.g. instances from i-1234abcd to i-0123456789abcdef) was a huge 
deal; even though the identifier length was never guaranteed, plenty of folks 
had created database schemata with VARCHAR(10) for instance ids, for example.

Break assumptions from day 1. If some platforms happen to return sorted 
results, sort the other platforms or toss in a sorted(key=lambda el: 
random.randomint()) call on the sorting platform. If you’re creating custom 
identifiers, allocate twice as many bits as you think you’ll need to store it.

Yes, this is bad user code, but I’m all for breaking bad user code in obvious 
ways sooner rather than subtle ways later, especially in a language like Python.

[*] 
https://arstechnica.com/information-technology/2019/10/chemists-discover-cross-platform-python-scripts-not-so-cross-platform/

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/TKVGVH5GHOL3YH7W55MEU2PHASSPY74M/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to