March 2003
Intermediate to advanced
656 pages
39h 30m
English
proxy
proxy(x[,f])
Returns a weak proxy p of type
ProxyType (CallableProxyType,
if x is callable), with object
x as the target. In most contexts, using
p is just like using
x, except that if you use
p after x has
been deleted, Python raises ReferenceError.
p is never hashable (therefore you cannot
use p as a dictionary key), even when
x is. If f is
present, it must be callable with one argument, and is the
finalization callback for p (i.e., right
before finalizing x, Python calls
f
(
p
)).
Note that when f is called,
x is no longer reachable from
p.