Changing the names of python keywords and functions
"Martin v. Löwis"
martin at v.loewis.de
Fri Jun 22 00:36:10 EDT 2007
>>> "<<koristiti>> OS"- (THIS IS MY IMAGINARY EXAMPLE OF KEYWORD),
>>> my program must write this code in some user file, but my
>>> program must read this command like: "import os".How
>>> can I do something like that??
>> The keywords are listed in Grammar/Grammar. You need to edit
>> this file, then recompile.
>
> To clarify, are you suggesting changing the source code of the Python
> implementation and recompiling it?
Correct.
> If the keywords are changed in the Python executable, won't that break
> the import of any Python module written for the standard keywords --
> such as many of those in the standard library?
Most certainly, yes.
> My understanding of the original poster's requirement was that the
> keywords should be additional to, not replacement for, the existing
> Python keywords.
So he should make them additional in the grammar, too.
It is entirely beyond me *why* the OP wants to do that, but changing
the compiler would be the proper way of implementing that change.
Regards,
Martin
More information about the Python-list
mailing list