There are many questions out there regarding this subject which I already checked. Example dated 2014!
One can also find the 'canonical' documentation here.
I don't know why I cannot reproduce the docs:
import weakref, gc
class A:
pass
a = A()
b = weakref.ref(a)
a
Out[5]: <__main__.A at 0x250f782f3a0>
b()
Out[6]: <__main__.A at 0x250f782f3a0>
del a
b()
Out[8]: <__main__.A at 0x250f782f3a0>
gc.collect()
Out[9]: 9
b()
Out[10]: <__main__.A at 0x250f782f3a0>
b
should be returning None
but is not.
EDIT
Interestingly, this question on which I am interested as well, remains unanswered since a couple of years as well. Just tagging in case somebody can address both in one shot.
(Windows 10, python 3.8, Conda env)