[Python-ideas] Make all keywords legal as an identifier
Terry Reedy
tjreedy at udel.edu
Mon Apr 25 22:02:28 CEST 2011
On 4/25/2011 3:36 PM, haael wrote:
> 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.
This very fact makes us *very* reluctant to add new keywords, which I
think is a pretty good thing.
> Solution:
> Let the parser treat all keywords that come after a dot (".") as regular
> identifiers.
I have no idea what the technical difficulties would be. However, one
possible practical difficulty is that whether or not a name is dotted
depends on the context.
a.py:
x = 3 # ok
as = 4 # syntax error
b.py
import a
a.x = 3 # ok
a.as = 4 # ok with your proposal, but code within a could not access it.
Same for code in the body of a class statement versus code without.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list