weakref in Python
Feb. 13, 2024weakref module allows to create "weak" references to objects. It's not enough to have a weak reference to keep an objects alive - if weak references are the only references the object has, then garbage collector will remove the object and reuse the memory for other objects. However, while the object isn't deleted, a weak reference can return it even if there are no regular references to the objects.