What is weakref and when is it useful?
Answer
•weakref holds a weak reference, not preventing object deletion.
•Useful for caches and observers.
•When the object is deleted, weakref becomes empty.
•There are WeakKeyDictionary/WeakValueDictionary.
•Use carefully to avoid unexpected None.
Was this answer helpful?