[Python-ideas] Crazy idea: allow keywords as names in certain positions

Tim Peters tim.peters at gmail.com
Sun May 13 16:01:09 EDT 2018

> ...
> I should also mention that this was inspired from some messages where Tim
> Peters berated the fashion of using "reserved words", waxing nostalgically
> about the old days of Fortran (sorry, FORTRAN), which doesn't (didn't?) have
> reserved words at all (nor significant whitespace, apart from the "start in
> column 7" rule).

The Fortran standards continued evolving, and still are, but despite
that in many ways it's become a much more "modern" language, while it
continues to add ever more keywords it _still_ has no reserved words.
They have a strong reason for that:  there are numeric libraries coded
decades ago in Fortran still in use, which nobody understands anymore,
so anything that breaks old code is fiercely opposed.  If you think
people whine today about an incompatible Python change, wait another
30+ years to get a sense of what it's like in the Fortran community

I'm not sure people realize that Algol had no reserved words either.
But that was "a trick" :-)  Algol was originally designed as a formal
notation for publishing algorithms, not really for executing them.
Published Algol "code" always showed the language's keywords in

Similarly, the nearly incomprehensible (to me) Algol 68's 60 "reserved
words" are essentially defined to be in boldface in the
"representation" (for publication) language, but can also be used as
identifiers etc.  The intimately related but distinct "reference
language" needs to be used for computer input.  In that the reserved
words are decorated in some way, to distinguish them from user-defined
names of the same spelling. There's more than one way to do that, and
- indeed - it's required that Algol 68 compilers support several
specific ways.  Anyone looking for more pain can get it here:


Note that Perl largely (but not entirely) managed to dodge the problem
by requiring a punctuation character (like $ for scalar and @ for
array) before variable names.

In addition to REXX (already mentioned), Prolog and PL/I had no reserved words.

End of brain dump ;-)

But I didn't suggest that for Python.  It's a bit too late for that
anyway ;-)  It was more in line with what you suggested here:  think
more about ways in which reserved words _could_ be allowed as
identifiers in specific contexts where implementing that doesn't
require heroic effort.

More information about the Python-ideas mailing list