Python garbage collection via weak references