5 ms·
I think this behavior will only be working starting from Python 3.6, as the dictionary obtained by calling `dict.fromkeys()` before this would not keep the orde
by StreakyCobra 8y ago
I think this behavior will only be working starting from Python 3.6, as the dictionary obtained by calling `dict.fromkeys()` before this would not keep the ordering [1]
[1] https://youtu.be/p33CVV29OG8?t=489 https://youtu.be/p33CVV29OG8?t=489
- bhrgunatha 8y agoI love that talk. Raymond Hettinger is a gem. What I took from that is the implementation does preserve order but it isn't guaranteed yet and in theory it could change.
- StreakyCobra 8y ago> I love that talk. Raymond Hettinger is a gem. This talk is definitely worth a watch yes :) > What I took from that is the implementation does preserve order but it isn't guaranteed yet and in theory it could change. This was the case for python 3.6, but starting from Python 3.7 ordering is guaranteed [1]: Changed in version 3.7: Dictionary order is guaranteed to be insertion order. [1] https://docs.python.org/3.7/library/stdtypes.html#dict-views https://docs.python.org/3.7/library/stdtypes.html#dict-views
- teddyh 8y ago> Raymond Hettinger is a gem. His talks are good, except that every time he asks a stupid rhetorical question of the audience I’m overwhelmed with the urge to wang¹ a tomato at him. 1. https://www.gunnerkrigg.com/?p=330 https://www.gunnerkrigg.com/?p=330