Class destructors

Graham Ashton graham at
Wed Jun 20 05:43:14 EDT 2001

I understand that Python doesn't have the equivalent of the DESTROY()
method in Perl, as the tutorial says:

  "There are no special constructors or destructors."

Surely there is a way of executing some code before the garbage collector
destroys the object though? Can anybody give me some pointers?

Specifically, I want to close a socket when I've finished with my object
without having to do so explicitly from with the program that uses the



More information about the Python-list mailing list