[Python-ideas] With-expression

Mathias Panzenböck grosser.meister.morti at gmx.net
Tue Jan 20 21:25:53 CET 2009

Calvin Spealman schrieb:
> On Tue, Jan 20, 2009 at 8:00 AM, Sturla Molden <sturla at molden.no> wrote:
>> On 1/20/2009 2:47 AM, Gregory P. Smith wrote:
>>>    I always preferred:
>>>    data = open("file.txt").read()
>>>    Which works all the way back as far as I can remember.
>>> In C Python yes that "works" but it makes absolutely no guarantees about
>>> when that file is actually closed.  Don't write code that depends on a
>>> particular GC behavior.
>> Then why not introduce that guarantee? Indeterministic GC behaviour is a
>> Jython and IronPython problem.
> We cannot and should not define aspects of the language which do
> (especially on purpose) specifically deny other implementations from
> respecting that change.

And who knows, maybe someday Pythons GC will change its strategy to something
more like Java? Then this would break a lot of code. (Well, most likely it would


More information about the Python-ideas mailing list