[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1156375 - /subversion/branches/fs-py/subversion/python/svn/fs.py

From: Branko Čibej <brane_at_xbc.nu>
Date: Thu, 11 Aug 2011 01:15:10 +0200

On 10.08.2011 23:35, Greg Stein wrote:
> On Wed, Aug 10, 2011 at 17:26, <hwright_at_apache.org> wrote:
>> Author: hwright
>> Date: Wed Aug 10 21:26:36 2011
>> New Revision: 1156375
>>
>> URL: http://svn.apache.org/viewvc?rev=1156375&view=rev
>> Log:
>> On the fs-py branch:
>> Followup to r1156347: use a bit cleaner syntax to automagically close files.
>>
>> * subversion/python/svn/fs.py
>> (FS.set_uuid, FS._open_fs): Use the with statement.
> And now where did your .close() call go? You're still relying on 'f'
> going out of scope to close. IOW, right back to the zero refcount
> algorithm. And in which case, the original construction is much
> cleaner than all this "with" gunk.
>
> ???

Greg, you should keep up with the times. :)

Explicit management of rare resources is no bad thing. The "with"
statement was introduced specifically to do away with the flaky, three
times longer try-except-else that would otherwise be necessary in order
to guarantee that file objects are closed.

And yes, the CPython docs do say that file objects are closed when their
refcount reaches zero, but also state that one shouldn't rely on that.
Also see the second stanza in PEP 20. :)

There's no call to jump all over people because you don't agree with
their coding style.

-- Brane
Received on 2011-08-11 01:15:42 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.