[Python-ideas] Making colons optional?

Riobard Zhan yaogzhan at gmail.com
Mon Feb 9 03:35:50 CET 2009


On 8-Feb-09, at 4:35 AM, Steven D'Aprano wrote:

> 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:
> milk
> fruit
> meat
>
> 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 separator.
>
> In Python: only commas are item separators. Semi-colons and newlines  
> are statement separators. Colons are not separators at all.

We are talking about Python here.

Mike proposed it is consistent if we treat semicolons as separators in  
the same fashion as commas (another separators), which I do not think  
that is the right way (at least for me). See my other reply to Mike's  
reply if it is not clear.

Nobody said colons are separators.




More information about the Python-ideas mailing list