class documentation

class MultiMap:

View In Hierarchy

A multimap class built upon use of an underlying map for storage.

This uses dict for default storage.

Subclasses can override class variable _MapType to change the default. That catalog class must have a default constructor that produces an empty map. As an example, one might define the following subclass to use a SortedTableMap:

  class SortedTableMultimap(MultiMap):
      _MapType = SortedTableMap
Method __init__ Create a new empty multimap instance.
Method __iter__ Iterate through all (k,v) pairs in multimap.
Method __len__ Return number of (k,v) pairs in multimap.
Method add Add pair (k,v) to multimap.
Method find Return arbitrary (k,v) pair with given key (or raise KeyError).
Method find_all Generate iteration of all (k,v) pairs with given key.
Method pop Remove and return arbitrary (k,v) pair with key k (or raise KeyError).
Instance Variable _map Undocumented
Instance Variable _n Undocumented
def __init__(self):

Create a new empty multimap instance.

def __iter__(self):

Iterate through all (k,v) pairs in multimap.

def __len__(self):

Return number of (k,v) pairs in multimap.

def add(self, k, v):

Add pair (k,v) to multimap.

def find(self, k):

Return arbitrary (k,v) pair with given key (or raise KeyError).

def find_all(self, k):

Generate iteration of all (k,v) pairs with given key.

def pop(self, k):

Remove and return arbitrary (k,v) pair with key k (or raise KeyError).

_map =

Undocumented

_n: int =

Undocumented