4 ms·
Well, things change, especially in tech. For better or worse, but most of the time for the better. You should read some changelogs of past python 3 releases. 3
by BozeWolf 10y ago
Well, things change, especially in tech. For better or worse, but most of the time for the better.
You should read some changelogs of past python 3 releases. 3.6, for example, has ordered dicts by default. Which is quite convenient when you need to write test testing a small dict with two items for example.
I like driving an old muscle car, most of m look beautiful and bring me everywhere i want. But damn, those new cars changed a lot and are much more comfortable. (But they do break as much ;))
- nicpottier 10y agoPretty sure they say NOT to rely on the ordered nature of the new dicts. So definitely not something you want to put in your tests.
- gsnedders 10y agoThe intention is to make the order guaranteed in 3.7 or 3.8, AIUI. There was some desire to prove the new implementation before guaranteeing its behaviours (i.e., in the worst case, if it turned out to be broken, they could revert to the 3.5 code and it would be valid).
- BozeWolf 10y agoNo it is in 3.6 already! It used to be not guaranteed. https://mail.python.org/pipermail/python-dev/2016-September/146327.html https://mail.python.org/pipermail/python-dev/2016-September/... But it is insertion order indeed, not sorting order.
- gsnedders 10y agoThe behaviour is there in CPython, yes. But the language documentation doesn't, deliberately.