Back to index

plone3  3.1.7
Public Member Functions | Private Attributes
PlonePAS.odict.OrderedDict Class Reference

List of all members.

Public Member Functions

def __init__
def keys
def clear
def update
def setdefault
def values
def __iter__
def itervalues
def iterkeys
def iteritems
def __delitem__
def __setitem__
def __getitem__

Private Attributes

 _list

Detailed Description

A Dictionary that returns keys/values/items in the order they were added

Definition at line 7 of file odict.py.


Constructor & Destructor Documentation

def PlonePAS.odict.OrderedDict.__init__ (   self,
  d = None,
  kwargs 
)

Definition at line 9 of file odict.py.

00009 
00010     def __init__(self, d=None, **kwargs):
00011         self._list = []
        self.update(d, **kwargs)

Member Function Documentation

def PlonePAS.odict.OrderedDict.__delitem__ (   self,
  key 
)

Definition at line 44 of file odict.py.

00044 
00045     def __delitem__(self, key):
00046         try:
00047             del self._list[self._list.index(key)]
00048         except ValueError:
00049             raise KeyError(key)
        dict.__delitem__(self, key)
def PlonePAS.odict.OrderedDict.__getitem__ (   self,
  key 
)

Definition at line 54 of file odict.py.

00054 
00055     def __getitem__(self, key):
00056         return dict.__getitem__(self, key)

Here is the caller graph for this function:

Definition at line 36 of file odict.py.

00036 
00037     def __iter__(self):
        return iter(self._list)

Here is the caller graph for this function:

def PlonePAS.odict.OrderedDict.__setitem__ (   self,
  key,
  object 
)

Definition at line 50 of file odict.py.

00050 
00051     def __setitem__(self, key, object):
00052         if not self.has_key(key):
00053             self._list.append(key)
        dict.__setitem__(self, key, object)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 14 of file odict.py.

00014 
00015     def clear(self):
00016         self._list = []
        dict.clear(self)

Definition at line 42 of file odict.py.

00042 
00043     def iteritems(self):
        return iter([(key, self[key]) for key in self.keys()])

Here is the call graph for this function:

Definition at line 40 of file odict.py.

00040 
00041     def iterkeys(self): 
        return self.__iter__()

Here is the call graph for this function:

Definition at line 38 of file odict.py.

00038 
00039     def itervalues(self):
        return iter([self[key] for key in self._list])

Definition at line 12 of file odict.py.

00012 
00013     def keys(self):
        return list(self._list)

Here is the caller graph for this function:

def PlonePAS.odict.OrderedDict.setdefault (   self,
  key,
  value 
)

Definition at line 28 of file odict.py.

00028 
00029     def setdefault(self, key, value):
00030         if not self.has_key(key):
00031             self.__setitem__(key, value)
00032             return value
00033         else:
            return self.__getitem__(key)
def PlonePAS.odict.OrderedDict.update (   self,
  d = None,
  kwargs 
)

Definition at line 17 of file odict.py.

00017 
00018     def update(self, d=None, **kwargs):
00019         # d can be a dict or sequence of keys/values
00020         if d:
00021             if hasattr(d, 'iteritems'):
00022                 seq = d.iteritems()
00023             else:
00024                 seq = d
00025             for key, value in seq:
00026                 self.__setitem__(key, value)
00027         if kwargs:
            self.update(kwargs)

Here is the caller graph for this function:

Definition at line 34 of file odict.py.

00034 
00035     def values(self):
        return [self[key] for key in self._list]

Here is the caller graph for this function:


Member Data Documentation

Definition at line 10 of file odict.py.


The documentation for this class was generated from the following file: