Nick Coghlan wrote: > Lie Ryan wrote: > How about making odict ordered by insertion order, then provide an >> optional argument for defining sorter? This optional argument must be a >> function/lambda/callable object and must be the first argument. or better yet, in the spirit of dumping cmp comparison like in list, the first optional argument would be a function that returns the sorting key of the object. If the optional argument is not specified, the current ordereddict semantic (by insertion order) will be used. > As the PEP mentions (and Hrvoje brought up again already in this > thread), a hash table (i.e. dict) probably isn't the right data > structure to use as the basis for an "always sorted" container. > In-memory databases, balanced trees, etc, etc. Isn't ordered dictionary essentially also an "always sorted" container? It is always sorted depending on the order of insertion? I can't see any technical reason why the data structure can't accommodate them both. Can you point me to a discussion on this?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4