Just to be clear, if `foo` was introduced as a new infix operator, projects that used `foo` as a name would not be able to also use `foo` as an infix operator in the file that defines `foo` as a name, but could use the operator throughout the rest of their project.
-- Carl Smith carl.in...@gmail.com On 14 May 2018 at 21:52, Carl Smith <carl.in...@gmail.com> wrote: > I can only think of three ways to reference a name defined in a different > file: In an import > statement, 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 name > into your local namespace. > > from <keyword> import <keyword> as <name> > > Property names always follow a dot, where only a name is valid, so Python > could allow > this too: > > <expression>.<keyword> > > Keyword arguments are also generally unambiguous, as they have to appear > within the > parens of an invocation, before the equals sign: > > <expression>(<keyword>=<expression>) > > If Python allowed those three examples (but still prevented users from > *defining* names > that are keywords) new keywords could be introduced without breaking old > code , and the > language would only require relatively minor tweaking. > > -- Carl Smith > carl.in...@gmail.com > > On 14 May 2018 at 19:11, Terry Reedy <tjre...@udel.edu> wrote: > >> On 5/14/2018 10:02 AM, Clint Hepner wrote: >> >>> >>> On 2018 May 14 , at 6:47 a, Daniel Moisset <dmois...@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/ >> > >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/