Why is "as" not a keyword?
Rainer Deyke
root at rainerdeyke.com
Thu Jan 18 21:50:02 EST 2001
"Jesse W" <jessw at loop.com> wrote in message news:3A679717.1328 at loop.com...
> Most people know about the functionality of the import statement that
> lets you import something under a differnt name. It uses the word "as"
> to tell the interpreter. Why is "as" not a keyword? Other flag parts
> of commands are keywords, like "in", or "from". Why not "as"?
> Currently, it seems to me to be confusing when you type
> import foo as bar
> in IDLE, and import lights up as a keyword, but "as", which has to be
> there and is clearly part of the syntax, does not. If this question has
> been answered already, pardon me; I have not seen the answer anywhere.
There are two issues here: whether or not 'as' should be a keyword, and
whether or not IDLE should highlight it.
On the first issue: 'as' was added to the language fairly recently. There
could still be legacy code which uses 'as' as a variable name. If 'as' was
a keyword, this code would break. The way things currently are, legacy code
merely becomes confusing.
On the second issue: I think it should, personally. It would be even if
IDLE only highlighted 'as' where it is used as a keyword. For example, in
'import as as as', only the middle 'as' should be highlighted. But I don't
use IDLE, so it's really a non-issue to me.
--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list
mailing list