Is there a way to get the current ref count of an object in Python?

According to the Python documentation, the sys module contains a function:

import sys
sys.getrefcount(object) #-- Returns the reference count of the object.

Generally 1 higher than you might expect, because of object arg temp reference.

Leave a Comment