I can only think of three ways to reference a name defined in a different file: In an importstatement, as properties of objects and as keyword arguments.Import statements are implicit assignments, so if Python allowed the following grammar,you could still import the odd thing that had a reserved name, without bringing that nameinto your local namespace.from <keyword> import <keyword> as <name>Property names always follow a dot, where only a name is valid, so Python could allowthis too:<expression>.<keyword>Keyword arguments are also generally unambiguous, as they have to appear within theparens of an invocation, before the equals sign:<expression>(<keyword>=<expression>) If Python allowed those three examples (but still prevented users from *defining* namesthat are keywords) new keywords could be introduced without breaking old code , and thelanguage would only require relatively minor tweaking.-- Carl SmithOn 14 May 2018 at 19:11, Terry Reedy <tjreedy@udel.edu> wrote:On 5/14/2018 10:02 AM, Clint Hepner wrote:
On 2018 May 14 , at 6:47 a, Daniel Moisset <dmoisset@machinalis.com> wrote:
Following up some of the discussions about the problems of adding keywords and Guido's proposal of making tokenization context-dependent, I wanted to propose an alternate way to go around the problem.
My main objection to what follows is that it doesn't seem to offer any benefit over the current practice of appending an underscore (_) to a keyword to make it a valid identifier.
Tkinter uses this convention for a few option names that clash.
--
Terry Jan Reedy
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/