3 ms·
The crucial thing about IndexedMap is that it is not actually order preserving. If it gets inconvenient to preserve order, it's just not preserved. For example
by tialaramex 2y ago
The crucial thing about IndexedMap is that it is not actually order preserving.
If it gets inconvenient to preserve order, it's just not preserved. For example if I put sixty items in, then remove thirty and add forty more, IndexedMap doesn't put all those forty items "after" the remaining thirty from the removal because that's more work.
Python does preserve order, the fact that internally it looks somewhat like IndexedMap is an implementation detail.
- masklinn 2y ago> the fact that internally it looks somewhat like IndexedMap is an implementation detail. It really is not. IndexMap was directly inspired by Python’s naturally ordered dicts. It’s spelled out right in the readme. And while indexmap has weaker ordering guarantees for performance reasons (though also additional features aplenty), “ordermap” was revived as a wrapper which does conserve ordering on removal.