of destructors, open files and garbage collection

massimo s. devicerandom at gmail.com
Thu May 24 12:53:09 EDT 2007


> Relying on the `__del__()` method isn't a good idea because there are no
> really hard guaranties by the language if and when it will be called.

Ok, I read the __del__() docs and I understand using it is not a good
idea.

I can easily add a close_files() method that forces all dangling files
to be closed. It would be useful in a number of other possible
situations. However, as rightly pointed out by the exhaustive answer
of Paul Moore, tracking references of my objects would be very useful.
How can I do that?




More information about the Python-list mailing list