lildoodilydo
lildoodilydo

Reputation: 71

A BTree implementation in python that allows duplicate keys?

I'm trying to build a structure for indexing a database. i.e., pairing the indexed values with a pointer to the tuple. I found https://pythonhosted.org/BTrees/, however, the API tells me that it doesn't allow for insertion of multiple keys with different values. I find this problematic when I want to create an index on a column that isn't the primary key.

Is there a BTree implementation in python that does allow for insertion of the same keys?

Upvotes: 1

Views: 1291

Answers (1)

dfsmshsm
dfsmshsm

Reputation: 11

You can create a dictionary, with the values being either a list (for duplicate values), or a set (to exclude duplicate values).

Upvotes: 1

Related Questions