Module collections :: Class defaultdict
[hide private]
[frames] | no frames]

type defaultdict

object --+    
         |    
      dict --+
             |
            defaultdict

defaultdict(default_factory) --> dict with default factory

The default factory is called without arguments to produce a new value when a key is not present, in __getitem__ only. A defaultdict compares equal to a dict with the same items.

Instance Methods [hide private]
a shallow copy of D.
__copy__(D)
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
new empty dictionary

__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__missing__(...)
__missing__(key) # Called by __getitem__ for missing key; pseudo-code: if self.default_factory is None: raise KeyError(key) self[key] = value = self.default_factory() return value
 
__reduce__(...)
Return state information for pickling.
 
__repr__(x)
repr(x)
a shallow copy of D.
copy(D)

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getitem__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __setitem__, clear, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Properties [hide private]
  default_factory
Factory for default value called by __missing__().
Method Details [hide private]

__getattribute__(...)

 

x.__getattribute__('name') <==> x.name

Overrides: dict.__getattribute__

__init__(...)
(Constructor)

 

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

Returns:
new empty dictionary

Overrides: dict.__init__

__reduce__(...)

 

Return state information for pickling.

Overrides: object.__reduce__

__repr__(x)
(Representation operator)

 

repr(x)

Overrides: dict.__repr__

copy(D)

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