How to fix those errors?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Nov 18 17:33:02 EST 2014


Roy Smith wrote:

> In article <54694389$0$13001$c3e8da3$5496439d at news.astraweb.com>,
>  Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
> 
>> Chris Angelico wrote:
>> 
>> > You should be able to use two semicolons, that's equivalent to one
>> > colon right?
>> > 
>> > ChrisA
>> > (No, it isn't, so don't take this advice. Thanks.)
>> 
>> 
>> Oooh! Python-ideas territory!
>> 
>> I think the parser should allow two consecutive semi-colons, or four
>> commas, as an alias for a colon. Then we could write code like:
>> 
>> 
>> def spam(arg);;
>>     for x in seq,,,,
>>         pass
> 
> Wouldn't it make more sense to use four periods?
> 
> def spam(arg)....
>     for x in seq....
>         pass
> 
> First, 2 colons is 4 dots, so it's conservation of punctuation.  Second,
> it reads pretty well.


Four periods .... is already legal, it is ellipsis followed by dot:

py> ....__class__
<class 'ellipsis'>


(Try it in Python 3, it actually works!)



-- 
Steven




More information about the Python-list mailing list