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

sys.getrefcount

Prev: sys.getrecursionlimit | Up: sys | Next: sys.getsizeof
Rel: sys.activate_stack_trampoline, sys.addaudithook, sys.audit, sys.breakpointhook
Ref: docs.python.org — sys.getrefcount
Tags: #public #python3 #stdlib #sys


Import

import sys
from sys import getrefcount

Signature & Overview

sys.getrefcount(object, /)

Return the reference count of object.

Usage

import sys

obj = object()
# At least 2: one for `obj`, plus one temporary reference for the getrefcount() argument
assert sys.getrefcount(obj) >= 2

Gotchas

REPL Inspect

from sys import getrefcount
help(getrefcount)

Linked from

Related notes