
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
Of course, if a keyword is not preceded by a dot, it would be treated as a reserved word, just like now.
with = 3 # syntax error
There is only one case where a dot is used as a prefix of an identifier and that is a relative module import.
from .boo import foo My change is consistent with this case.
One benefit would be that converting current programs to work with future versions would be a matter of simple grep. Python is a great language. In my opinion, this change is the one last step to make it every geeky teenager's wet dream: the language where one can redefine almost anything. When I work with some problem, I always try to translate it to Python, solve and translate back. Prohibited identifier names are the main obstacle. So, let's set the identifiers free and swallow all the world, making Python the least common denominator of every computer problem on this planet. Regards, Bartosz Tarnowski ------------------------------------------------- Jedz te potrawy, aby uchronic sie przed rakiem! Sprawdz >> http://linkint.pl/f2946