On 1 November 2016 at 01:51, Mark E. Haase <meha...@gmail.com> wrote: > Stephen J. Turnbull wrote: >> >> I gather you think you have a deadlock here. The way to break it is >> to just do it. Pick a syntax and do the rewriting. My memory of some >> past instances is that many of the senior devs (especially Guido) will >> "see through the syntax" to evaluate the benefits of the proposal, >> even if they've said they don't particularly like the initially- >> proposed syntax. > > I don't feel deadlocked, but I think you're right about committing to a > syntax. So I updated the PEP, summarized here: > > Spelling a new operator as a keyword is difficult due to backward > compatibility. It can be done (see PEP-308 and PEP-492) but requires extreme > care. > A keyword operator is considered less ugly than punctuation, but it makes > assignment shortcut syntax very ugly. Assume the coalesce operator is "foo", > then the assignment shortcut would be "x foo= y". This is unacceptable. > If eliminate the possibility of a keyword and focus on punctuation, we find > that most people think "??" — the syntax that exists in several other > mainstream languages — is ugly and not Pythonic. > However, any other punctuation spelling will be at least as ugly and will > not have the benefit of being familiar to programmers who have seen null > coalescing in other languages. > Therefore, the most reasonable spelling is to borrow the same spelling that > other languages use, e.g. "??", "?.", and "?[". > > I did go down the road of trying to create a new keyword, trying some > mundane ideas ("foo else bar") and some more exotic ideas ("try foo then > bar"), but I don't know if those syntaxes are even parseable, and as I > worked through a bunch of examples, I realized that all of the keywords I > was trying were very awkward in practical use, especially when combined with > other expressions.
I do think it would be worth covering the symbol+keyword option discussed in PEP 531 (i.e. "?else" instead of "??", but keeping "?.", and "?[") Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/