[Twisted-web] Custom __del__ not run
Rasjid Wilcox
rasjidw at openminddev.net
Tue Jul 26 18:31:10 MDT 2005
On Tue, 26 Jul 2005 10:39 pm, Jp Calderone wrote:
> "Finished"? "__del__" isn't a "finished" callback. It's a garbage
> collection callback.
Oh. I had the misconception that the __del__ routine would always be called
eventually, even if it was not until the interpreter was about to exit.
However, this seems not to be the case.
> Alternatively
>
> from twisted.internet import reactor
>
> class MyThing:
> def __init__(self):
> reactor.addSystemEventTrigger('before', 'shutdown', self.stop)
>
> def stop(self):
> print 'bye bye'
>
> th = MyThing()
This seems to work perfectly. Thanks.
Rasjid.
--
Rasjid Wilcox
Melbourne, Australia (UTC +10 hrs)
More information about the Twisted-web
mailing list