I played with the python ctypes module to better understand how the garbage collector works. While playing in the interpreter, I came across this strange situation:
>>>import ctypes
>>>def get_ref(obj):
... """ This returns the refcount of obj as a c_size_t """
... return ctypes.c_size_t.from_address(id(obj))
...
>>>myInt = 0
>>>get_ref(myInt)
c_ulong(283L)
Why does myInt seem to refer to Python 283 times? Did I miss something?
Thanks for your ideas.
source
share