class documentation
class MultiMap:
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 |
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 |