Given below snippet code in python Idle, why the sys.getrefcount(a)
returns 4?
Given below snippet of code when executed in python idle
import sys
a = []
b = a
sys.getrefcount(a) # returns 3
a
sys.getrefcount(a) #returns 4
print(a)
sys.getrefcount(a) #returns 3
Can anyone please explain why reference count gets increased to 4?