pytries / hat-trie

HAT-Trie for Python
MIT License
86 stars 21 forks source link

Is there any particular reason you don't allow storing arbitrary Python objects as values? #7

Closed b4hand closed 10 years ago

b4hand commented 10 years ago

I was curious if there was any particular reason you don't allow storing arbitrary Python objects as values?

It looks like the underlying C library just stores unsigned long as value_t, but it seems like you could store a PyObject * by simply casting it to value_t.

kmike commented 10 years ago

I think that's a good idea.

It seems it is better to still support "raw" int values (maybe in a base class) because this is more memory efficient when the values are ints.

b4hand commented 10 years ago

Yeah, I figured I'd rename the current Trie class to IntTrie or something similar and then add a new Trie class that allows arbitrary value storage.

kmike commented 10 years ago

That would be perfect.