Python vs Java garbage collection?

"Martin v. Löwis" martin at v.loewis.de
Mon Dec 23 06:06:33 EST 2002


Erik Max Francis wrote:
> The documentation explicitly says that one should not rely on finalizers
> being called in a timely manner or even at all in some cases.  So one
> should not rely on it.  I'm really surprised at the level of furor over
> such a basic point that even the documentation specifically mentions.

It is no surprise that the documentation must mention this; there is 
precedent that "some implementations" behave differently (and this note 
was explicitly added to make JPython a conforming implementation). The 
documentation has no chance to observe the finer points of all this, as 
it must take the option into account that somebody produces another 
Python implementation based on it (and we do encourage people doing so).

However, it is also not surprising that people defend their programming 
practice to rely on the open(filename).read() pattern to DTRT: Nobody 
wants to be accused of being a sloppy programmer. If you add the facts 
of life to the facts of documentation, you see that there is really 
nothing wrong with such a programming practice - if you are aware of all 
the finer points.

Regards,
Martin





More information about the Python-list mailing list