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

jamadagni samjnaa at gmail.com
Sat Apr 14 13:20:06 CEST 2007


> 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:

with the dot preceding quit also. Excellent!

But you have said "variable names can't begin with a number". The
point this, they shouldn't be able to begin with a *dot*. We are not
worried about numbers here, right?




More information about the Python-list mailing list