On this page
  1. weakref.getweakrefcount
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

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

REPL Inspect

from weakref import getweakrefcount
help(getweakrefcount)

Linked from

Related notes