[Python-Dev] Simple syntax proposal: "not is"

Nick Coghlan ncoghlan at gmail.com
Fri Jan 25 17:37:02 CET 2008


Jameson "Chema" Quinn wrote:
> I'm writing a source code editor that translates identifiers and 
> keywords on-screen into a different natural language. This tool will do 
> no transformations except at the reversible word level. There is one 
> simple, avoidable case where this results in nonsense in many languages: 
> "is not". I propose allowing "not is" as an acceptable alternative to 
> "is not".

Your editor is going to have to deal with code written the normal way 
anyway - given that this is a pretty special case, the special handling 
should stay in the tool that needs it (your editor) not in the 
programming language.

As you say, Python is heavily influenced by English, and in English "a 
not is b" is out-and-out nonsense (there is no way to build a coherent 
parse tree with that word order), while "not a is b" and "a is not b" 
both make sense (although you are correct in pointing out that the 
latter is technically ambiguous as an English phrase).

"is not" and "not in" are just normal binary operators that happen to 
consist of two words in the concrete syntax - your editor is going to 
need to be able to deal with that (even if that means having to handle 
translations that span multiple words).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list