On 2020-03-15 5:19 p.m., Chris Angelico wrote:
On Mon, Mar 16, 2020 at 7:14 AM Christopher Barker <pythonchb@gmail.com> wrote:
But back the python_ideas topic:
It might be good to have a set of real, tree-based data structures -- they are the best way to go for some use cases, and are non-trivial to implement well.
(and yes, starting out at a third party package, maybe one that's already out there, would be the way to go)
Recommendation: If anything is added to the standard library, it should be named according to its use-cases, not its implementation. Python has a "dictionary", not a "hashtable". You might think *today* that a binary tree is the only way you'd ever want this to be implemented, but in twenty years' time, maybe there'll be a different data structure with equivalent semantics and better performance.
Don't do what SourceMod did, and bake the name "trie" into its API...
https://sm.alliedmods.net/new-api/adt_trie/CreateTrie
The word "Trie" in this API is historical. As of SourceMod 1.6, tries have been internally replaced with hash tables, which have O(1) insertion time instead of O(n).
RangedDict? (range-restricted views on binary trees are super efficient.)
:)
ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/6UA2KV... Code of Conduct: http://python.org/psf/codeofconduct/