with open('com1', 'r') as f:

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Apr 5 13:24:00 CEST 2009

On Sun, 05 Apr 2009 18:52:58 +1200, Lawrence D'Oliveiro wrote:

> In message <01e842d6$0$20654$c3e8da3 at news.astraweb.com>, Steven D'Aprano
> wrote:
>> Firstly, what you describe is an implementation detail of CPython, not
>> Python the language. Jython does not close files as soon as they become
>> inaccessible, and IronPython and CLPython may not.
> That's a limitation of Java-like virtual machines, which I have no
> intention of condonig.

You don't have to condone it, but you do have to live with it.

>> Secondly, even in CPython things may not be so simple. Not all
>> file-like objects are built-in file objects.
> Why is this relevant?

File-like objects might not automatically close themselves.


More information about the Python-list mailing list