Python vs Java garbage collection?

"Martin v. Löwis" martin at v.loewis.de
Mon Dec 23 05:37:54 EST 2002


Erik Max Francis wrote:
> My point was simply was
> that Python as a language does not guarantee prompt and certain
> finalization, regardless of what CPython does.

And I still believe that "Python as a language" is a myth (a unicorn, to 
be precise :-). There is no formal language definition, just a "language 
reference", and that is changed with every release of CPython. In 
addition to that, there are various books that describe "the language", 
two fundamentally different "implementations" of it, and many 
implementations that differ in detail. Furthermore, people rightly 
consider "the standard library" to be a proper part of "the language". 
The library varies across systems even within a single release (and for 
good reasons).

> What was a minor aside ended up being inflated into a major issue.  It
> was really a side comment; I was simply pointing out that since the
> behavior is marked as unspecified, for all intents and purposes CPython
> _could_ change and that would be just fine according to the ad hoc
> "specification" that the documentation constitutes.

See, and this is precisely where you are mistaken. Whether a change can 
or cannot happen is only marginally affected by what the language 
reference says. The commitment to not breaking too many applications 
across releases of CPython is a much bigger influence. The reference 
counting is so ingrained into the implementation, and the many extension 
modules, and a large number of applications, that there is no chance 
that this will change in a foreseeable future, indepedent of what "the 
language" says.

As I just said, predicting the future is always difficult, and it only 
becomes a little easier by taking all facts into account. Of course, for 
"mere users", taking implementation details into account may not be 
advisable, so relying on the documentation is good advise, in general. 
In this specific case, trusting that reference counting is a fact should 
be allowed, though.

Regards,
Martin





More information about the Python-list mailing list