Trees | Index | Help |
---|
Package Bio :: Package EUtils :: Module MultiDict :: Class UnorderedMultiDict |
|
_BaseMultiDict
--+
|
UnorderedMultiDict
Store key/value mappings.
Acts like a standard dictionary with the following features:>>> ud = UnorderedMultiDict([("Food", "Spam"), ("Color", "Blue"), ... ("Food", "Eggs"), ("Color", "Green")]) >>> ud["Food"] 'Eggs' >>> ud.getall("Food") ['Spam', 'Eggs'] >>>
The order of values from a given key (as from ud.getall("Food")) is guaranteed but the order between keys (as from od.allkeys() and od.allitems()) is not.
Can also pass in an object to the constructor which has an allitems() method that returns a list of key/value pairs.Method Summary | |
---|---|
__init__(self,
multidict)
| |
Remove all values for the given key | |
Does this UnorderedMultiDict have the same keys, with values in the same order, as another? | |
Does this UnorderedMultiDict NOT have the same keys, with values in the same order, as another? | |
__repr__(self)
| |
Add a new key/value pair | |
iterate over all key/value pairs, in arbitrary order | |
iterate over all keys in arbitrary order | |
iterate over all values in arbitrary order | |
Inherited from _BaseMultiDict | |
check if the key exists | |
value for a given key | |
iterate through the list of unique keys | |
the number of unique keys | |
shows contents as if this is a dictionary | |
value for the given key; default = None if not present | |
Get all values for a given key | |
unordered list of key/value pairs | |
unordered list of unique keys | |
unordered list of values |
Method Details |
---|
__delitem__(self,
key)
Remove all values for the given key
|
__eq__(self,
other)
Does this UnorderedMultiDict have the same keys, with values in the
same order, as another?
|
__ne__(self, other)Does this UnorderedMultiDict NOT have the same keys, with values in the same order, as another? |
__setitem__(self,
key,
value)
|
allitems(self)iterate over all key/value pairs, in arbitrary order Actually, the keys are iterated in arbitrary order but all values for that key are iterated at sequence of addition to the UnorderedMultiDict. |
allkeys(self)iterate over all keys in arbitrary order |
allvalues(self)iterate over all values in arbitrary order |
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Thu Jun 30 22:05:36 2005 | http://epydoc.sf.net |