weakref | index /usr/lib/python2.7/weakref.py

`Weak reference support for Python.
This module is an implementation of PEP 205:
http://www.python.org/dev/peps/pep-0205/`

Modules

``

UserDict |  |  |

Classes

``

UserDict
  WeakKeyDictionary
  WeakValueDictionary
__builtin__.weakref(object)
  KeyedRef

class KeyedRef(__builtin__.weakref)
`` | `Specialized reference that includes a key corresponding to the value. This is used in the WeakValueDictionary to avoid having to create a function object for each key stored in the mapping. A shared callback object can use the 'key' attribute of a KeyedRef instead of getting a reference to the key from an enclosing scope.`

Method resolution order:
  KeyedRef
  __builtin__.weakref
  object

Methods defined here:

__init__(self, ob, callback, key)

Static methods defined here:

__new__(type, ob, callback, key)

Data descriptors defined here:

key

Methods inherited from __builtin__.weakref:

__call__(...)
  `x.__call__(...) <==> x(...)`

__eq__(...)
  `x.__eq__(y) <==> x==y`

__ge__(...)
  `x.__ge__(y) <==> x>=y`

__gt__(...)
  `x.__gt__(y) <==> x>y`

__hash__(...)
  `x.__hash__() <==> hash(x)`

__le__(...)
  `x.__le__(y) <==> x<=y`

__lt__(...)
  `x.__lt__(y) <==> x<y`

__ne__(...)
  `x.__ne__(y) <==> x!=y`

__repr__(...)
  `x.__repr__() <==> repr(x)`

class WeakKeyDictionary(UserDict)
`` | `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.`

Methods defined here:

__contains__(self, key)

__copy__ = copy(self)

__deepcopy__(self, memo)

__delitem__(self, key)

__getitem__(self, key)

__init__(self, dict=None)

__iter__ = iterkeys(self)

__repr__(self)

__setitem__(self, key, value)

copy(self)

get(self, key, default=None)

has_key(self, key)

items(self)

iteritems(self)

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)

itervalues(self)

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)

pop(self, key, *args)

popitem(self)

setdefault(self, key, default=None)

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

Methods inherited from UserDict:

__cmp__(self, dict)

__len__(self)

clear(self)

values(self)

Class methods inherited from UserDict:

fromkeys(cls, iterable, value=None) from __builtin__.classobj

Data and other attributes inherited from UserDict:

__hash__ = None

class WeakValueDictionary(UserDict)
`` | `Mapping class that references values weakly. Entries in the dictionary will be discarded when no strong reference to the value exists anymore`

Methods defined here:

__contains__(self, key)

__copy__ = copy(self)

__deepcopy__(self, memo)

__delitem__(self, key)

__getitem__(self, key)

__init__(self, *args, **kw)

__iter__ = iterkeys(self)

__repr__(self)

__setitem__(self, key, value)

clear(self)

copy(self)

get(self, key, default=None)

has_key(self, key)

items(self)

iteritems(self)

iterkeys(self)

itervaluerefs(self)
  `Return an iterator that yields the weak references to the values.
  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 values around longer than needed.`

itervalues(self)

pop(self, key, *args)

popitem(self)

setdefault(self, key, default=None)

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

valuerefs(self)
  `Return a list of weak references to the values.
  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 values around longer than needed.`

values(self)

Methods inherited from UserDict:

__cmp__(self, dict)

__len__(self)

keys(self)

Class methods inherited from UserDict:

fromkeys(cls, iterable, value=None) from __builtin__.classobj

Data and other attributes inherited from UserDict:

__hash__ = None

Functions

``

getweakrefcount(...)
  `getweakrefcount(object) -- return the number of weak references
  to 'object'.`

getweakrefs(...)
  `getweakrefs(object) -- return a list of all weak reference objects
  that point to 'object'.`

proxy(...)
  `proxy(object[, callback]) -- create a proxy object that weakly
  references 'object'. 'callback', if given, is called with a
  reference to the proxy when 'object' is about to be finalized.`

Data
`` |  | ProxyTypes = (<type 'weakproxy'>, <type 'weakcallableproxy'>) __all__ = ['ref', 'proxy', 'getweakrefcount', 'getweakrefs', 'WeakKeyDictionary', 'ReferenceError', 'ReferenceType', 'ProxyType', 'CallableProxyType', 'ProxyTypes', 'WeakValueDictionary', 'WeakSet'] __file__ = '/usr/lib/python2.7/weakref.pyc' __name__ = 'weakref'