Created
April 29, 2024 17:54
-
-
Save rhaschke/b9684a238c732e7a01e2d63e1195161b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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