[Python-ideas] relaxing keyword usage restrictions

Devin Jeanpierre jeanpierreda at gmail.com
Mon Sep 5 14:10:53 CEST 2011


The "as" keyword used to be a pseudokeyword that functioned this way.
Apparently the experiment didn't go well, as it was changed to a full
keyword in 2.6.

Devin

On Mon, Sep 5, 2011 at 12:55 AM, H Krishnan <hetchkay at gmail.com> wrote:
> Hi,
>
> Apologies if this has been asked already: why can't the usage of at
> least some keywords as identifiers be allowed with the context of the
> usage being used to identify if a keyword or a variable is being
> referred to.
>
> For example,
>
> if = 3  # if is identifier
> if if = 3: # first if is keyword, second if is identifer
>
> A more complex usage may require some rules:
>
> a = not or and and
> ==> parse left to right to interpret as a = ( (not or) and (and) ).
> 'or' and the last 'and' are identifiers
>
> While some of the usage may be confusing to the user, that is not for
> the language to dictate but for the user to choose.
>
> Almost all keywords have specific semantics which (in my limited
> understanding) do not conflict with their usage as identifiers.
>
> Regards,
> Krishnan
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



More information about the Python-ideas mailing list