Refcount Zero and Reused Addresses
This runs top to bottom under CPython 3.14:
class Foo:
def __del__(self):
print("Foo destroyed")
x = Foo()
print("before reassign")
x = None
print("after reassign")
a = [1, 2, 3]
first_id = id(a)
a = None
b = [4, 5, 6]
second_id = id(b)
print(first_id == second_id)
What does this print, in order?
Sign in to answer questions and track your progress
Sign In