[Python-ideas] Make all keywords legal as an identifier

Brian Curtin brian.curtin at gmail.com
Mon Apr 25 21:51:30 CEST 2011


On Mon, Apr 25, 2011 at 14:36, haael <haael at interia.pl> wrote:

>
> Hello, guys.
>
> I did post this idea a few months ago. Now the revised version.
>
>
> Goal:
> Let _all_ alphanumeric keywords be legal as names for variables, functions
> and classes, even the ones that are reserved words now.
>
> Rationale:
> 1. Python took most good English words as reserved tokens. Situation goes
> worse from version to version. I often have hard time searching for
> acceptable synonyms.
> 2. Because of that, old Python programs cease to work, even if they do not
> use any abandoned features. Their only sin is using certain words that
> further versions of Python have stolen away.
> 3. Sometimes one needs to import keywords from some other language, XML be
> an example, or "translate" another programming language into Python in one
> way or another. Keyword reservation is a big problem then; it does not allow
> to use the natural Python syntax.
>
> Solution:
> Let the parser treat all keywords that come after a dot (".") as regular
> identifiers.
>
>
> For attributes, nothing changes:
> > boo.for = 7
>
> For names that are not attributes, only one syntax change is needed: let a
> dot precede any identifier.
> > .with = 3
>

Names tend to be nouns, so first I can't imagine why you'd want "with" as a
name, but you could exchange almost all keywords in the example and it's not
a great case. Making this change rather than working around poor name choice
gets a -1 from me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110425/7a2fff1a/attachment.html>


More information about the Python-ideas mailing list