Quick actions

cmd+k|ctrl+k

Navigation

Languages

ctype

Snippet info

Language

Python

Visibility

public

Author

ttmo04450

Created

2026-06-23T08:35:48.110177Z

Updated

2026-06-23T08:41:31.265174Z

import sys

a=[1,2,3]
print(hex(id(a)))
print(sys.getrefcount(a))


import ctypes
def ref_count(address:int):
    return ctypes.c_long.from_address(address).value
    
print(ref_count(id(a)))

b=a

print(hex(id(b)))
print(ref_count(id(a)))

b=None
print(id(b))

a_id=id(a)
a =None
print(ref_count(a_id))
c=10
d=11
print(ref_count(a_id))
INFO