Trees | Index | Help |
---|
Package Bio :: Package EUtils :: Module MultiDict :: Class OrderedMultiDict |
|
_BaseMultiDict
--+
|
OrderedMultiDict
Store key/value mappings.
Acts like a standard dictionary with the following features:>>> od = OrderedMultiDict([("Food", "Spam"), ("Color", "Blue"), ... ("Food", "Eggs"), ("Color", "Green")]) >>> od["Food"] 'Eggs' >>> od.getall("Food") ['Spam', 'Eggs'] >>> list(od.allkeys()) ['Food', 'Color', 'Food', 'Color'] >>>
The order of keys and values(eg, od.allkeys() and od.allitems()) preserves input order.
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 OrderedMultiDict have the same contents and order as another? | |
Does this OrderedMultiDict have different contents or order as another? | |
__repr__(self)
| |
Add a new key/value pair | |
iterate over all key/value pairs in input order | |
iterate over all keys in input order | |
iterate over all values in input 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 OrderedMultiDict have the same contents and order as
another?
|
__ne__(self, other)Does this OrderedMultiDict have different contents or order as another? |
__setitem__(self,
key,
value)
|
allitems(self)iterate over all key/value pairs in input order |
allkeys(self)iterate over all keys in input order |
allvalues(self)iterate over all values in input order |
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Thu Jun 30 22:06:02 2005 | http://epydoc.sf.net |