Re:Why is Python's OrderedDict ordered?
by yxhuvud on Tuesday November 04, 2025 @12:43AM
(#45807738)
Well, that is how hash tables in go works, so you'd not have to look that far.
[ Parent
| on HN ]
Re:Why is Python's OrderedDict ordered?
by tasty_freeze on Tuesday November 04, 2025 @12:59AM
(#45807806)
Perl since 5.8.something has had the option of perturbing the hash function, so it is different from run to run. You can also set the set to a given value in order to lock in the sequence.
In any case, it is not ordered. If you want that, you have to explicitly sort the keys of the hash.
Re:Why is Python's OrderedDict ordered?
by not_kurt_godel on Tuesday November 04, 2025 @12:52AM
(#45807773)
Great. Maybe GP will go a step farther and also mandate arrays that return elements in random order too. Relying on insertion order for any reason is for weaklings.