Fork me on GitHub

API

Collection classes implemented using prefix trees.

PrefixDict

class prefixtree.PrefixDict([arg])

Implementation of MutableMapping that conforms to the interface of dict.

A PrefixDict has some extensions to the interface of dict.

d[i:j:k]

Return iterable from i to j in the direction k.

If i or j is None the slice is open ended. k may be -1 or 1. If -1 the values are returned in reverse order.

commonprefix(key)

Find the longest common prefix between the key provided and the keys in the PrefixDict.

startswith(prefix)

Iterate over all keys that begin with the supplied prefix.

PrefixSet

class prefixtree.PrefixSet([iterable])

Implementation of MutableSet that conforms to the interface of set.