Skip to content

Instantly share code, notes, and snippets.

@rhaschke
Created April 29, 2024 17:54
Show Gist options
  • Save rhaschke/b9684a238c732e7a01e2d63e1195161b to your computer and use it in GitHub Desktop.
Save rhaschke/b9684a238c732e7a01e2d63e1195161b to your computer and use it in GitHub Desktop.
class A:
def __init__(self):
print("A.__init__", self)
self.other = None
def __del__(self):
print("A.__del__", self)
class Binder:
def __init__(self, o1, o2):
o1.other = o2
o2.other = o1
def __del__(self):
print("Binder.__del__", self)
def f():
a1 = A()
a2 = A()
Binder(a1, a2)
print(("bound: " + 4 * "\n{}").format(a1, a1.other, a2, a2.other))
f()
print("done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment