Module weakref :: Class WeakKeyDictionary
[hide private]
[frames] | no frames]

_ClassType WeakKeyDictionary

UserDict.UserDict --+
                    |
                   WeakKeyDictionary

Mapping class that references keys weakly.

Entries in the dictionary will be discarded when there is no longer a strong reference to the key. This can be used to associate additional data with an object owned by other parts of an application without adding attributes to those objects. This can be especially useful with objects that override attribute accesses.

Instance Methods [hide private]
 
__init__(self, dict=None)
 
__delitem__(self, key)
 
__getitem__(self, key)
 
__repr__(self)
 
__setitem__(self, key, value)
 
copy(self)
 
get(self, key, default=None)
 
has_key(self, key)
 
__contains__(self, key)
 
items(self)
 
iteritems(self)
 
iterkeyrefs(self)
Return an iterator that yields the weak references to the keys.
 
iterkeys(self)
 
__iter__(self)
 
itervalues(self)
 
keyrefs(self)
Return a list of weak references to the keys.
 
keys(self)
 
popitem(self)
 
pop(self, key, *args)
 
setdefault(self, key, default=None)
 
update(self, dict=None, **kwargs)

Inherited from UserDict.UserDict: __cmp__, __len__, clear, values

Class Methods [hide private]

Inherited from UserDict.UserDict: fromkeys

Method Details [hide private]

__init__(self, dict=None)
(Constructor)

 
Overrides: UserDict.UserDict.__init__

__delitem__(self, key)
(Index deletion operator)

 
Overrides: UserDict.UserDict.__delitem__

__getitem__(self, key)
(Indexing operator)

 
Overrides: UserDict.UserDict.__getitem__

__repr__(self)
(Representation operator)

 
Overrides: UserDict.UserDict.__repr__

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

 
Overrides: UserDict.UserDict.__setitem__

copy(self)

 
Overrides: UserDict.UserDict.copy

get(self, key, default=None)

 
Overrides: UserDict.UserDict.get

has_key(self, key)

 
Overrides: UserDict.UserDict.has_key

__contains__(self, key)
(In operator)

 
Overrides: UserDict.UserDict.__contains__

items(self)

 
Overrides: UserDict.UserDict.items

iteritems(self)

 
Overrides: UserDict.UserDict.iteritems

iterkeyrefs(self)

 

Return an iterator that yields the weak references to the keys.

The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the keys around longer than needed.

iterkeys(self)

 
Overrides: UserDict.UserDict.iterkeys

itervalues(self)

 
Overrides: UserDict.UserDict.itervalues

keyrefs(self)

 

Return a list of weak references to the keys.

The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the keys around longer than needed.

keys(self)

 
Overrides: UserDict.UserDict.keys

popitem(self)

 
Overrides: UserDict.UserDict.popitem

pop(self, key, *args)

 
Overrides: UserDict.UserDict.pop

setdefault(self, key, default=None)

 
Overrides: UserDict.UserDict.setdefault

update(self, dict=None, **kwargs)

 
Overrides: UserDict.UserDict.update