[Python-ideas] Making colons optional?

Steven D'Aprano steve at pearwood.info
Sun Feb 8 09:05:01 CET 2009

Riobard Zhan wrote:
> On 6-Feb-09, at 8:41 PM, Mike Meyer wrote:
>> That this consistency - ignoring trailing separators in list
>> structures - can be misunderstood to be an optional ending separator
>> in the degenerate case of a single statement is a good indication of
>> why consistency isn't a trump property.
> This is a very strange view of consistency to me. How many different 
> kinds of list separators do we have? I can only think of semicolons and 
> commas. 

In English: commas, semi-colons, slashes and newlines. There may be 
others, but I can't think of them off the top of my head. Examples:

Sandwiches are made of bread, cheese, tomato, ham, and eggs.

The hospital was visited by the following dignitaries: the President, Mr 
Obama; the Queen, Elisabeth II; and a famous actor, Bruce Willis.

The invitation is for you and your wife/husband/partner.

Shopping List:

In programming languages: commas and semi-colons are usual. OpenOffice 
spreadsheet uses ; to separate arguments to formulas, which never ceases 
to annoy me. I've seen at least one Context-Free Grammar format that 
uses vertical bar | as a list separator. I presume Lisp uses whitespace. 
If I recall correctly, so does Forth. Hypertalk separates "items" with 
commas and "words" with spaces, although the item delimiter was 
configurable in later versions. Tab delimited files use tabs as the item 

In Python: only commas are item separators. Semi-colons and newlines are 
statement separators. Colons are not separators at all.


More information about the Python-ideas mailing list