5 '''list with an internal dictionary for indexing, 6 allowing to keep dictionary elements ordered. 7 keys can be everything except an integer. 15 def add( self, key, value ):
16 if isinstance(key, (int, long)):
17 raise ValueError(
"key cannot be an integer")
19 raise ValueError(
"key '{key}' already exists".
format(key=key) )
20 self.
dico[key] = len(self)
24 '''index can be a dictionary key, or an integer specifying 25 the rank of the value to be accessed 30 except (TypeError, ValueError):
37 '''These functions are quite risky...''' 39 return super(diclist, self).
__setitem__(index, value)
40 except TypeError
as ValueError:
def __setitem__(self, index, value)
def __getitem__(self, index)
def add(self, key, value)