[Python-ideas] Trie ABC?

Stephen J. Turnbull stephen at xemacs.org
Mon May 6 07:03:32 CEST 2013


Geoffrey Sneddon writes:

 > Currently there are a large number of trie implementations for Python, 
 > all with slightly different APIs. It would be nice to introduce a ABC 
 > for Tries to attempt to unify these.

I don't understand why you want an ABC.  Mapping is the ABC, Trie is a
concrete implementation, and an actual trie is an instance of Trie.
Wouldn't canonizing one of the existing implementations into the
stdlib be the straight way forward?

The fact that that was tried once and failed doesn't mean it's not the
right thing.  Cf. enums (multiple PEPs, finally succeeded with PEP 435).

 > Why do people want tries in Python?

I don't think that question needs to be asked, tries are a well-known
data structure with clear (if somewhat specialized) uses.





More information about the Python-ideas mailing list