Package nltk :: Module containers :: Class OrderedDict
[hide private]
[frames] | no frames]

Class OrderedDict

source code

object --+    
         |    
      dict --+
             |
            OrderedDict

This implementation of a dictionary keeps track of the order in which keys were inserted.

Instance Methods [hide private]
new empty dictionary

__init__(self, d={})
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__delitem__(self, key)
del x[y]
source code
 
__setitem__(self, key, item)
x[i]=y
source code
None
clear(self)
Remove all items from D.
source code
list of D's (key, value) pairs, as 2-tuples
items(self) source code
list of D's keys
keys(self) source code
(k, v), remove and return some (key, value) pair as a
popitem(self)
2-tuple; but raise KeyError if D is empty
source code
D.get(k,d), also set D[k]=d if k not in D
setdefault(self, key, failobj=None) source code
None
update(self, d)
Update D from E and F: for k in E: D[k] = E[k] (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]
source code
list of D's values
values(self) source code
 
move(self, key, index)
Move the specified to key to *before* the specified index.
source code
 
index(self, key) source code

Inherited from dict: __cmp__, __contains__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, copy, fromkeys, get, has_key, iteritems, iterkeys, itervalues, pop

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, d={})
(Constructor)

source code 

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

Returns:
new empty dictionary

Overrides: dict.__init__
(inherited documentation)

__delitem__(self, key)
(Index deletion operator)

source code 

del x[y]

Overrides: dict.__delitem__
(inherited documentation)

__setitem__(self, key, item)
(Index assignment operator)

source code 

x[i]=y

Overrides: dict.__setitem__
(inherited documentation)

clear(self)

source code 

Remove all items from D.

Returns: None
Overrides: dict.clear
(inherited documentation)

items(self)

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

keys(self)

source code 
Returns: list of D's keys
Overrides: dict.keys
(inherited documentation)

popitem(self)

source code 

2-tuple; but raise KeyError if D is empty

Returns: (k, v), remove and return some (key, value) pair as a
Overrides: dict.popitem
(inherited documentation)

setdefault(self, key, failobj=None)

source code 
Returns: D.get(k,d), also set D[k]=d if k not in D
Overrides: dict.setdefault
(inherited documentation)

update(self, d)

source code 

Update D from E and F: for k in E: D[k] = E[k] (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]

Returns: None
Overrides: dict.update
(inherited documentation)

values(self)

source code 
Returns: list of D's values
Overrides: dict.values
(inherited documentation)