Package translate :: Package misc :: Module dictutils :: Class ordereddict

[hide private]
[frames] | no frames]

# Class ordereddict

source code

a dictionary which remembers its keys in the order in which they were given

Instance Methods | [hide private]

    new empty dictionary

__init__(self, *args) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code

__setitem__(self, key, value) x[i]=y | source code

None

update(D, E) Update D from E: for k in E.keys(): D[k] = E[k] | source code

__delitem__(self, key) del x[y] | source code

a shallow copy of D

copy(D) | source code

list of D's (key, value) pairs, as 2-tuples

items(D) | source code

an iterator over the (key, value) items of D

iteritems(D) | source code

an iterator over the keys of D

iterkeys(D) iter(x) | source code

an iterator over the keys of D

__iter__(D) iter(x) | source code

an iterator over the values of D

itervalues(D) | source code

list of D's keys

keys(D) | source code

(k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty

popitem(D) 2-tuple; but raise KeyError if D is empty | source code

v, remove specified key and return the corresponding value

pop(self, key) remove entry from dict and internal list | source code

Inherited from `dict`: `__cmp__`, `__contains__`, `__eq__`, `__ge__`, `__getattribute__`, `__getitem__`, `__gt__`, `__hash__`, `__le__`, `__len__`, `__lt__`, `__ne__`, `__new__`, `__repr__`, `clear`, `fromkeys`, `get`, `has_key`, `setdefault`, `values` Inherited from `object`: `__delattr__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__str__`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, *args)
(Constructor)

source code

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Returns:

    new empty dictionary

Overrides: object.__init__
  (inherited documentation)

### __setitem__(self, key, value)
(Index assignment operator)

source code

x[i]=y

Overrides: dict.__setitem__
  (inherited documentation)

### update(D, E)

source code

Update D from E: for k in E.keys(): D[k] = E[k]

Returns: None
Overrides: dict.update

### __delitem__(self, key)
(Index deletion operator)

source code

del x[y]

Overrides: dict.__delitem__
  (inherited documentation)

### copy(D)

source code

Returns: a shallow copy of D
Overrides: dict.copy

### items(D)

source code

Returns: list of D's (key, value) pairs, as 2-tuples
Overrides: dict.items

### iteritems(D)

source code

Returns: an iterator over the (key, value) items of D
Overrides: dict.iteritems

### iterkeys(D)

source code

iter(x)

Returns: an iterator over the keys of D
Overrides: dict.iterkeys

### __iter__(D)

source code

iter(x)

Returns: an iterator over the keys of D
Overrides: dict.__iter__

### itervalues(D)

source code

Returns: an iterator over the values of D
Overrides: dict.itervalues

### keys(D)

source code

Returns: list of D's keys
Overrides: dict.keys

### popitem(D)

source code

2-tuple; but raise KeyError if D is empty

Returns: (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty
Overrides: dict.popitem

### pop(self, key)

source code

remove entry from dict and internal list

Returns: v, remove specified key and return the corresponding value
Overrides: dict.pop