import sys, threading, time class D: def __del__(self): try: 1/0 except: self.a = 1 class WellBehavedClient: def run(self): while True: connection = D() sys.stderr.write('.') def run(): client = WellBehavedClient() thread = threading.Thread(target=client.run, args=()) thread.setDaemon(True) thread.start() time.sleep(0.2) run()