Quick actions

cmd+k|ctrl+k

Navigation

Languages

Python Web - L03(Register)

Snippet info

Language

Python

Visibility

public

Author

victormakwaitat

Created

2025-02-05T07:10:08.717288Z

Updated

2025-02-05T07:48:54.233669Z

c = 1
b = 1
#print(id(c), id(b))
import sys
a = [1,2,3]
#print(id(a))
#print(sys.getrefcount(a))
import ctypes
def ref_count(address: int):
    return ctypes.c_long.from_address(address).value    # how many variables point at single address
print(ref_count(id(a)))
b = a
print(ref_count(id(b)))
b = 10
print(ref_count(id(a)))
b = 10000000000 # preloaded
print(ref_count(id(b)))
INFO