Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic
Bjoern Schliessmann
usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Sat Apr 14 08:12:12 EDT 2007
samjnaa at gmail.com wrote:
> In Visual Basic there is the keyword "with" which allows an
> object- name to be declared as governing the following statements.
> For example:
>
> with quitCommandButton
> .enabled = true
> .default = true
> end with
>
> This is syntactic sugar for:
>
> quitCommandButton.enabled=true
> quitCommandButton.default=true
Personally, I'd never use it. In more complex modules, when you are
looking for, e. g., self.myVar and anotherObject.myVar,
this "using" statement decreases readability and maintainability
(in full text searching). IMHO.
Regards,
Björn
--
BOFH excuse #406:
Bad cafeteria food landed all the sysadmins in the hospital.
More information about the Python-list
mailing list