dict :: Class dict

Class dict

object --+
         |
        dict
Known Subclasses:

dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's
    (key, value) pairs
dict(iterable) -> new dictionary initialized as if via:
    d = {}
    for k, v in iterable:
        d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
    in the keyword argument list.  For example:  dict(one=1, two=2)

Instance Methods
 
__cmp__(x, y)
cmp(x,y)
True if D has a key k, else False
__contains__(D, k)
 
__delitem__(x, y)
del x[y]
 
__eq__(x, y)
x==y
 
__ge__(x, y)
x>=y
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
 
__getitem__(x, y)
x[y]
 
__gt__(x, y)
x>y
new empty dictionary

__init__()
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__iter__(x)
iter(x)
 
__le__(x, y)
x<=y
 
__len__(x)
len(x)
 
__lt__(x, y)
x<y
 
__ne__(x, y)
x!=y
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__repr__(x)
repr(x)
 
__setitem__(x, i, y)
x[i]=y
size of D in memory, in bytes
__sizeof__(D)
None
clear(D)
Remove all items from D.
a shallow copy of D
copy(D)
New dict with keys from S and values equal to v
fromkeys(dict, S, v=...)
v defaults to None.
D[k] if k in D, else d
get(D, k, d=...)
d defaults to None.
True if D has a key k, else False
has_key(D, k)
list of D's (key, value) pairs, as 2-tuples
items(D)
an iterator over the (key, value) items of D
iteritems(D)
an iterator over the keys of D
iterkeys(D)
an iterator over the values of D
itervalues(D)
list of D's keys
keys(D)
v, remove specified key and return the corresponding value
pop(D, k, d=...)
If key is not found, d is returned if given, otherwise KeyError is raised
(k, v), remove and return some (key, value) pair as a
popitem(D)
2-tuple; but raise KeyError if D is empty.
D.get(k,d), also set D[k]=d if k not in D
setdefault(D, k, d=...)
None
update(D, E, **F)
Update D from dict/iterable E and F.
list of D's values
values(D)

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

Class Variables
  __hash__ = None
hash(x)
Properties

Inherited from object: __class__

Method Details

__getattribute__(...)

 

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

Overrides: object.__getattribute__

__init__()
(Constructor)

 

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

Returns:
new empty dictionary

Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(x)
(Representation operator)

 

repr(x)

Overrides: object.__repr__

__sizeof__(D)

 
Returns: size of D in memory, in bytes
Overrides: object.__sizeof__

update(D, E, **F)

 

Update D from dict/iterable E and F. If E has a .keys() method, does: for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

Returns: None