[Skip Montanaro] > Could this be extended to many/most/all current instances of keywords in > Python? As Tim pointed out, Fortran has no keywords. It annoys me that I > (for example) can't define a method named "print". [Thomas Wouters] >No. I just (in the trainride from work to home ;) wrote a patch that adds >'from x import y as z' and 'import foo as fee', and came to the conclusion >that we can't make 'from' a non-reserved word, for instance. Because if we >change > >'from' dotted_name 'import' NAME* > >into > >NAME dotted_name 'import' NAME* > >the parser won't know how to parse other expressions that start with NAME, >like 'NAME = expr' or 'NAME is expr'. I know this because I tried it and it >didn't work :-) So we can probably make most names that are *part* of a >statement non-reserved words, but not those that uniquely identify a >statement. That doesn't leave much words, except perhaps for the 'in' in >'for' -- but 'in' is already a reserved word for other purposes ;) Just a datapoint. JPython goes a bit further in its attempt to unreserve reserved words in certain cases: - after "def" - after a dot "." - after "import" - after "from" (in an import stmt) - and as argument names This allow JPython to do: from from import x def def(): pass x.exec(from=1, to=2) This feature was added to ease JPython's integration to existing java libraries. IIRC it was remarked that CPython could also make use of such a feature when integrating to f.ex Tk or COM. regards, finn
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4