Skip to content

Instantly share code, notes, and snippets.

@koi8-r
Created September 26, 2025 18:39
Show Gist options
  • Select an option

  • Save koi8-r/7e53afaa4de9e853b0b6af06afe7c37d to your computer and use it in GitHub Desktop.

Select an option

Save koi8-r/7e53afaa4de9e853b0b6af06afe7c37d to your computer and use it in GitHub Desktop.
import weakref
class A: ...
def test_() -> None:
o = A()
ref = weakref.ref(o)
assert ref() is not None
del o
assert ref() is None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment