[Python-Dev] __del__ and tp_dealloc in the IO lib

Terry Reedy tjreedy at udel.edu
Fri Jan 23 21:52:56 CET 2009

Giovanni Bajo wrote:
>> You are so very wrong, my son. CPython's implementation strategy
>> *will* evolve. Several groups are hard at work trying to make a faster
>> Python interpreter, and when they succeed, everyone, including you,
>> will want to use their version (or their version may simply *be* the
>> new CPython).
> I'm basing my assumption on 19 years of history of CPython. Please, 
> correct me if I'm wrong, but the only thing that changed is that the 
> cyclic-GC was added so that loops are now collected, but nothing change 
> with respect to cyclic collection. And everybody (including you, IIRC) 
> has always agreed that it would be very very hard to eradicate reference 
> counting from CPython and all the existing extensions; so hard that it 
> is probably more convenient to start a different interpreter 
> implementation.

Your history is true, but sometimes history changes faster than most 
expect. [As in the last 13 months of USA.]  A year ago, I might have 
agreed with you, but in the last 6 months, there has been more visible 
ferment in the area of dynamic language implementations than I remember 
seeing in the past decade.  When Guido says "CPython's implementation 
strategy *will* evolve" [emphasis his], I  believe him.  So this is just 
the wrong time to ask that it be frozen ;-).

While a strong argument can be made that the remaining 2.x versions 
should not be changed, they do not apply to 3.x.  New code and ported 
old code should use 'with' wherever quick closing needs to be 
guaranteed.  The 3.0 manual clearly states "An implementation is allowed 
to postpone garbage collection or omit it altogether "

OK, it also goes on to say "(Implementation note: the current 
implementation uses a reference-counting scheme with (optional) delayed 
detection of cyclically linked garbage,...)"  I think the first part 
should at least be amended to 'the current CPython implementation' or 
'the CPython implementation currently' or even better 'one current 
implementation (CPython)' and a warning added "But this may change" and 
"is not true of all implementaions" if that is not made clear otherwise.

Terry Jan Reedy

More information about the Python-Dev mailing list