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

James Stroud jstroud at mbi.ucla.edu
Sat Apr 14 07:41:13 EDT 2007


jamadagni wrote:
>> I like this one for some reason. Just the "using self" would save hella
>> typing in a lot of classes. I would favor a convention with leading dots
>> to disambiguate from other variables. This wouldn't conflict with, say,
>> floats, because variable names can't begin with a number.
> 
> Excellent. Now we don't have to worry about the "first applicable
> instance" etc. Any member that begins with a dot will have the context
> governer auto-prefixed by the parser. This means that nested using
> statements should be like follows:
> 
> using self:
> __using .quit:

Under what circumstances would this not mean "using self.quit"? I think 
one  must be refreshingly imaginative to infer that I was proposing that 
we add "." to variable names in general. The idea would be that it 
specifies to which names the using statement applies.

James



More information about the Python-list mailing list