[Python-Dev] __del__ and tp_dealloc in the IO lib
Guido van Rossum
guido at python.org
Fri Jan 23 23:28:55 CET 2009
On Fri, Jan 23, 2009 at 12:52 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> 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 "
I would hope the 2.x manual says the same, since that same assumption
has been around explicitly ever since JPython was first introduced.
I'm not sure we should exempt 2.x from these changes (though if only
3.x could be made twice as fast it would of course encourage people to
upgrade... :-). We've had many changes in the past affecting the
lifetime of local variables, usually due to changes in the way
tracebacks were managed.
> 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.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev