Retrieving the list of references to an object in Python

As you can see, it’s impossible to find them all.

>>> sys.getrefcount(1)
791
>>> sys.getrefcount(2)
267
>>> sys.getrefcount(3)
98

Leave a Comment