Skip to content
Advertisement

Confused with reference count of objects in Python

I’m a little confused with the reference counts I see from my test code

JavaScript

When I run my code in both python2 and python3, it shows the reference count is off by 1. Where did the extra reference count come from?

JavaScript

So what happened? Why is it off by 1? Where did the extra count come from?

Advertisement

Answer

Did you look at the source code or the docs for getrefcount()

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement