[Python-ideas] on colon ':', and some more

Terry Reedy tjreedy at udel.edu
Thu Feb 13 14:16:12 CET 2014


Terminating a header says "I believe I have entered a syntactically 
correct header" The receiving system can use this to immediately do a 
header syntax check that would be invalid if performed too soon. The 
console and Idle Shell interactive interpreters console do this.
Idle version: (note the English use of ':' to end a header ;-)

 >>> a = 3
 >>> if a == (
	3): pass

 >>> if a == (:
	
SyntaxError: invalid syntax

Deleting or making the : optional is not compatibly with implicit line 
continuation. Explicit \ would have to be the only way to continue a 
logical header line on another physical line.

-----
= versus ==:
Info theory and common sense say that the more frequent indication 
should generally be given the shorter indication.  Assignment is much 
more common that equality comparison. Math gets away with overloading = 
partly because 'binding' is a declaration of equality, partly because 
logic and arithmetic are usually kept separate, and partly because 
logical equivalence is indicated with a 3-line character when needed. 
Since that is not an ascii character, we use a 2 character digraph as 
replacement.

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list