hdtv.weakref_proxy

This file contains a wrapper for weakref that the weak reference can be used the same way the real object would be used.

Classes

weakref

This class represents a weak reference based on the python

Module Contents

class hdtv.weakref_proxy.weakref(object)

This class represents a weak reference based on the python module weakref. The difference between weakref.ref and this class is that you can access the ref without calling it first. E.g.: foo = weak(bar) and bar has the attribute x. With a normal weakref.ref you need to call foo().x to get, this class makes it possible to just use foo.x.

All functions are passed to the real object behind the weakref. To check if the weakref is alive or not, you can compare the object with None. Do not use a simple if, because an object still alive can also be False (e.g. an empty list).

__getattribute__(attr)
__setattr__(attr, value)
__delattr__(attr)
__getitem__(key)
__delitem__(key)
__setitem__(key, value)
__bool__()
__eq__(other)
__ne__(other)
__gt__(other)
__lt__(other)
__ge__(other)
__le__(other)
__str__()
__deepcopy__(memo)