Class destructors

Graham Ashton graham at coms.com
Wed Jun 20 11:43:14 CEST 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
object.

Thanks.

--
Graham



More information about the Python-list mailing list