"as" keyword woes

George Sakkis george.sakkis at gmail.com
Tue Dec 9 11:57:22 EST 2008


On Dec 9, 9:28 am, MRAB <goo... at mrabarnett.plus.com> wrote:

> I certainly wouldn't want something like PL/I, where "IF", "THEN" and
> "ELSE" could be identifiers, so you could have code like:
>
>      IF IF = THEN THEN
>          THEN = ELSE;
>      ELSE
>          ELSE = IF;

Although I agree with the sentiment, you can write uncomprehensibly
insane code in any language; Python already gives a lot of horsepower
to run wild with metaclass magic, bytecode hacking, etc. The fact that
you *can* write abominations as the above doesn't mean that you
should; the OP's use case - using "foo.as(int)" - is pretty reasonable
and readable. I believe the responsibility to not abuse the power of
the language should be on the application programmer, not the language
designer.

George



More information about the Python-list mailing list