Class destructor

Mike Meyer mwm at mired.org
Sat Feb 15 19:49:47 EST 2003


Sorry for the delayed post, but I wanted to see if someone more
knowledgable might bring this up. Since it instead evolved into a
discussion of what is and isn't garbage collection, I'll do it now.

Roberto Cavada <cavada at irst.itc.it> writes:
> If it is correct, I think this is a strong restriction, because I
> cannot control the lifetime of instances.
> What's the solution in this case?

The solution in this case is that you don't do that. Freeing the
programmer from having to worry about references to destroyed
instances or leaking instances is usually considered a feature of
Python.

Apparently, you have a problem that you feel the del statement would
solve, except that you can't control when the actual del
happens. Rather than asking us about how you control when the del
happens (which varies depending on the gc of the underlying python),
why don't you tell us about the problem you are trying to use del to
solve. That way, we may be able to tell you a pythonic way to solve
that problem.

        <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