Re: "with" statement in the python gio wrapper ?



On Mon, May 25, 2009 at 10:52 AM, Alexander Larsson <alexl redhat com> wrote:
> On Fri, 2009-05-22 at 10:51 +0200, David Versmisse wrote:
>> Hello,
>>
>> I don't know if i'm on the good mailing list, sorry if not.
>>
>> I have a question about the python wrapper of gio.
>>
>> Do you plan to use the new "with" statement with all the gio objects. By
>> example:
>>
>> g_file = File('foo.txt')
>> with g_file.replace('', False) as f:
>>       ....
>>
>> Naturally, it's just a question to organize our development.
>>
>> By advance, thank you for your answer, and thank you for your library!
>
> I don't know if any python developers are on this list, but i don't see
> how your question affects the gio python code, it seems more about
> python code that uses the python gio library.
>

Well, to get more than just a slightly nicer syntax including
automatic and transparent locking/unlocking and opening/closing, the
gio File class would have to explicitly support this by doing the
right thing in __enter__ and __exit__, so perhaps that is what David
was asking. http://effbot.org/zone/python-with-statement.htm and the
PEP have useful info on this.

-- 
Michael Rooney
mrooney gmail com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]