Re:A high-performance, zero-overhead, extensible Python comp...
by baq on Thursday September 19, 2024 @03:20AM
(#41589401)
dicts ordering keys in insertion order isn't an implementation detail anymore and hasn't been for years.
[ Parent
| on HN ]
Re:A high-performance, zero-overhead, extensible Python comp...
by nick238 on Thursday September 19, 2024 @03:21PM
(#41595368)
I get that all dicts are now effectively an `collections.OrderedDict`, but I've never seen practical code that uses the insertion order. You can't do much with that info (no `.pop()`, can't sort a dict without recreating it) beyond maybe helping readability when you print or serialize it.
Re:A high-performance, zero-overhead, extensible Python comp...
by funny_falcon on Friday September 20, 2024 @04:06PM
(#41605136)
Readability, reproducibility, and simple LRU.
Reproducibility matters for tests, they become simpler. Some other algorithms become simpler as well.
LRU is just a dict with preserving order: on access just delete and insert again.