weakref.getweakrefcount
Prev: weakref.finalize | Up: weakref | Next: weakref.getweakrefs
Rel: weakref.CallableProxyType, weakref.finalize, weakref.getweakrefs, weakref.proxy
Ref: docs.python.org — weakref.getweakrefcount
Tags: #public #python3 #stdlib #weakref
Import
import weakref
from weakref import getweakrefcount
Signature & Overview
weakref.getweakrefcount(object, /)
Return the number of weak references to 'object'.
Usage
import weakref
class Box: pass
b = Box()
r = weakref.ref(b)
assert weakref.getweakrefcount(b) == 1
Gotchas
- Counts active weak references and proxies pointing to
obj.
REPL Inspect
from weakref import getweakrefcount
help(getweakrefcount)
Linked from
- tuts/python3/stdlib_module/weakref
- tuts/python3/stdlib_module/weakref/CallableProxyType
- tuts/python3/stdlib_module/weakref/finalize
- tuts/python3/stdlib_module/weakref/getweakrefs
- tuts/python3/stdlib_module/weakref/proxy
- tuts/python3/stdlib_module/weakref/ProxyType
- tuts/python3/stdlib_module/weakref/ref
- tuts/python3/stdlib_module/weakref/ReferenceType
- tuts/python3/stdlib_module/weakref/WeakKeyDictionary
- tuts/python3/stdlib_module/weakref/WeakMethod
- tuts/python3/stdlib_module/weakref/WeakSet
- tuts/python3/stdlib_module/weakref/WeakValueDictionary
Related notes
- tuts/python3/stdlib_module/weakref/CallableProxyType Linked here; links to this page; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/finalize Linked here; links to this page; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/getweakrefs Linked here; links to this page; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/proxy 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/ProxyType links to this page; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/ref links to this page; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/ReferenceType links to this page; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/WeakKeyDictionary links to this page; shared tags: #stdlib, #weakref
- tuts/python3/stdlib_module/weakref/WeakMethod links to this page; shared tags: #stdlib, #weakref