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

jamadagni samjnaa at gmail.com
Sat Apr 14 09:28:13 EDT 2007


On Apr 14, 5:06 pm, Duncan Booth <duncan.bo... at invalid.invalid> wrote:

> I can't see how it is going to save you any typing over what you can
> already do.
>
> The suggested example:

The suggested example is only a small case. I realize that the main
usage would be when there are a lot of repetitive usages when the five
characters "using", the space and the colon at the end would be worth
the full typing.

> (259 characters including newlines but not leading indents).
> would become:
> (251 characters including newlines but not leading indents).

So there *is* gain even in this small case. It's a matter of avoiding
the bore and potential scope for typos in repetitive typing.

> If you are going to reference self.quit a lot of times then it makes
> sense to also assign it to a local variable and then you already get
> even fewer characters (239):

But you realize readability decreases considerably.




More information about the Python-list mailing list