does python have useless destructors?

Carl Banks imbosol at aerojockey.invalid
Mon Jun 14 17:02:02 EDT 2004


David Turner wrote:
>> I assumed that you knew this, and I assumed that you were aware of the
>> limitations of reference counting (in particular, that you cannot rely
>> on a reference count ever going to zero).  That is why I took your
>> statement to mean something else.
> 
> The limitations you refer to occur extremely infrequently in practice.

1. That's not my experience at all (it's not the the objects are
   involved reference cycles; it's that it's a member of some other
   object that's reference cycled).

2. Your claim of robustness is out the window.  What you ask for does
   not free the programmer from having to worry about when the
   resource will be freed.  It merely changes the question to, "Is it
   ok if there are cases when this resource totally fails to be
   freed?".

If that's all you want, and if doesn't adversely affect other concerns
(say, performance) too much, then I don't object to it, but it better
come with a disclaimer in big letters, because, unlike in C++, it
doesn't guarnatee anything.


-- 
CARL BANKS                      http://www.aerojockey.com/software
"If you believe in yourself, drink your school, stay on drugs, and
don't do milk, you can get work." 
          -- Parody of Mr. T from a Robert Smigel Cartoon



More information about the Python-list mailing list