[Python-ideas] With-expression
Calvin Spealman
ironfroggy at gmail.com
Tue Jan 20 15:38:09 CET 2009
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 if you are worried about not closing the file, why not close it
> manually?
>
> S.M.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
--
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy
More information about the Python-ideas
mailing list