Exceptions and Object Destruction (was: Problem with apsw and garbage collection)

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Tue Jun 16 03:34:35 EDT 2009


On Tue, 16 Jun 2009 16:45:43 +1200, Lawrence D'Oliveiro wrote:

> In message <m2eitowaf2.fsf at cs.uu.nl>, Piet van Oostrum wrote:
> 
>> The exact time of the destruction of objects is an implementation
>> detail and should not be relied upon.
> 
> That may be true in Java and other corporate-herd-oriented languages,
> but we know that dynamic languages like Perl and Python make heavy use
> of reference-counting wherever they can. If it's easy to satisfy
> yourself that the lifetime of an object will be delimited in this way, I
> don't see why you can't rely upon it.

Reference counting is an implementation detail used by CPython but not 
IronPython or Jython. I don't know about the dozen or so other minor/new 
implementations, like CLPython, PyPy, Unladen Swallow or CapPython.

In other words, if you want to write *Python* code rather than CPython 
code, don't rely on ref-counting.




-- 
Steven



More information about the Python-list mailing list