Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

BJörn Lindqvist bjourne at gmail.com
Sat Apr 14 19:46:10 CEST 2007


On 14 Apr 2007 07:24:32 -0700, jamadagni <samjnaa at gmail.com> wrote:
> > You already can emulate the using statement like this:
>
> You can emulate only assignments like this. How would you emulate
> function calls, like the ones in my example?

You can't, of course. But using the with statement:

using self.q:
    .doit()

becomes:

with self.quit as q:
    q.doit()

:)

-- 
mvh Björn



More information about the Python-list mailing list