[mod_python] Any support for Class Destructors

Oliver Mellet oliver at mellet.net
Sat Feb 7 13:34:56 EST 2004


If you define a __del__(self) method on your class, it will be 
called once the class instance's reference count drops to zero.
Just to be safe, tho, I wouldn't rely on this mechanism to release
important resources like db connections or file handles, but would
explicitly release them.


> -----Original Message-----
> From: mod_python-bounces at modpython.org 
> [mailto:mod_python-bounces at modpython.org] On Behalf Of jalil
> Sent: Saturday, February 07, 2004 1:12 PM
> To: python
> Subject: [mod_python] Any support for Class Destructors
> 
> 
> Is there a concept of class destructors in Python? I couldn't 
> find any. 
> If not, what is the right way to release resources that are 
> needed during the lifetime of an object w/o making an explict 
> call to a method?
> 
> Thanks,
> 
> -Jalil
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 



More information about the Mod_python mailing list