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

Duncan Booth duncan.booth at invalid.invalid
Sat Apr 14 12:45:18 EDT 2007


"jamadagni" <samjnaa at gmail.com> wrote:

>> 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.
> 
Not as much as it would with your 'using' statement. Using a local alias 
for an expression lets you use appropriate mnemonic abbreviations 
for multiple expressions with. Nested 'using' statements means you have to 
look back through the code to try to work out which is in scope at each 
level.



More information about the Python-list mailing list