On this page
weakref.ProxyType
Prev: weakref.proxy | Up: weakref | Next: weakref.ref
Rel: weakref.CallableProxyType, weakref.finalize, weakref.getweakrefcount, weakref.getweakrefs
Ref: docs.python.org — weakref.ProxyType
Tags: #public #python3 #stdlib #weakref
Import
import weakref
from weakref import ProxyType
Signature & Overview
weakref.ProxyType()
weakref.ProxyType class.
Usage
import weakref
class Box:
def __init__(self, x): self.x = x
b = Box(7)
p = weakref.proxy(b)
assert isinstance(p, weakref.ProxyType) and p.x == 7
Gotchas
- Transparent weak wrapper: Accessing
pafterbis garbage-collected raisesReferenceError.
REPL Inspect
from weakref import ProxyType
help(ProxyType)
Linked from
Related notes
- tuts/python3/stdlib_module/weakref/proxy Linked here; links to this page; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/ref Linked here; links to this page; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/weakref/CallableProxyType Linked here; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/finalize Linked here; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/getweakrefcount Linked here; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/getweakrefs Linked here; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/ReferenceType shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/WeakKeyDictionary shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/WeakMethod shared tags: #stdlib, #weakref