I am looking at the BTrees library and noticed that there are multiple TreeSet
(and others) classes, e.g.
BTrees.IOBTree.TreeSet
BTrees.OOBTree.TreeSet
BTrees.LFBTree.TreeSet
I understand that the BTree
class is different for each one of these as it accepts different types for the keys and values, but how about the TreeSet
class?
Though trial and error I found that the first letter dictates which types can be held by a TreeSet
instance, but what about the second letter? Does it have any influence on how the members are stored/retrieved?
Is there any documentation on that?
No, the TreeSet
classes ignore the second letter; they are provided in each XXBTree
module for completeness and ease of importing.
Under the covers, the modules are created using a lot of creative preprocessor macro work, making it also just easier to produce a TreeSet
type for each of the key-value type variants.
The package documentation relies in part on interface definitions; each module has an interface where the first sentence documents what the sets in that package contain:
class IIntegerObjectBTreeModule(IBTreeModule, IMerge):
"""keys, or set values, are integers; values are objects.
describes IOBTree and LOBTree"""
and
class IIntegerIntegerBTreeModule(IBTreeModule, IIMerge, IMergeIntegerKey):
"""keys, or set values, are integers; values are also integers.
describes IIBTree and LLBTree"""
for example illustrates that for both the IOBTree
and IIBTree
modules the set values are integers. As such, IOBTree.TreeSet
and IIBTree.TreeSet
are essentially the same.
The package documentation then uses those interface definitions to auto-generate the API docs, including the per-module documentation with the (tree)set value details.