|
Share and Money Management 0.18devel
|
A dictionary which can look up values by key, and keys by value. More...
Public Member Functions | |
| def | __init__ (self, *args, **kw) |
| Initialise the data structures. More... | |
| def | __setitem__ (self, key, value) |
| Set a new key / value pair. More... | |
| def | __delitem__ (self, key) |
| Remove a key / value pair out of both dictionaries. More... | |
Public Attributes | |
| reverse | |
| Dictionary to store the reverse data. More... | |
A dictionary which can look up values by key, and keys by value.
All values and keys must be hashable, and unique.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/415903
| def gui.helper.ReverseDict.__init__ | ( | self, | |
| * | args, | ||
| ** | kw | ||
| ) |
Initialise the data structures.
| def gui.helper.ReverseDict.__delitem__ | ( | self, | |
| key | |||
| ) |
Remove a key / value pair out of both dictionaries.
References gui.helper.ReverseDict.reverse.
| def gui.helper.ReverseDict.__setitem__ | ( | self, | |
| key, | |||
| value | |||
| ) |
Set a new key / value pair.
Already existing keys or values will be removed before adding new one.
References gui.helper.ReverseDict.reverse.
| gui.helper.ReverseDict.reverse |
Dictionary to store the reverse data.
The key / value pairs are reverse stored. This means the value is used as key and the origin key is stored as value in this dictionary. Thereby a fast reverse lookup to get the corresponding key of a given value.
Referenced by gui.helper.ReverseDict.__delitem__(), and gui.helper.ReverseDict.__setitem__().