Advice needed on __del__

Mike Meyer mwm at mired.org
Mon May 9 21:00:18 EDT 2005


phil <phillip.watts at anvilcom.com> writes:

> By the way, I understand that __del__ is only called when the last
> reference to an instance is deled.  That's fine, if consistent.

Actually, __del__ is called when the instance is garbage
collected. Exactly when that is is implementation dependent. In the
implementation you happen to be using, it'll happen when the last
reference is deleted. But depending on this makes your code less
portable.

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list