[Python-ideas] Making colons optional?
yaogzhan at gmail.com
Mon Feb 9 03:35:56 CET 2009
On 8-Feb-09, at 4:51 AM, Stephen J. Turnbull wrote:
> It appears to me that you're responding to something other than what I
> wrote. I wrote nothing about why semicolons are optional, only about
> why I believe they are redundant.
I apologize if you do not intend to do so, but the form of your
argument really tricked me to think so. See here
"In fact, the semicolon is indeed redundant, as it is precisely
equivalent to a newline + the current level of indentation. This kind
of redundancy is quite unusual in Python, so I wonder if the BDFL
might regret having permitted semicolons at all"
I take it as if the semicolons should be eliminated, but due to a
mistake they became optional, because they are redundant.
>> I think the conclusion is precisely the same for colons.
> My point was precisely that two syntaxes are appropriate balance with
> two semantics, but we have three syntax elements, so one is redundant.
> If you claim that is an argument for symmetry in treatment of colons
> and semicolons, I guess you are of the school that 3 - 1 = 1 for
> sufficiently large values of 1? But no, my point is that we can get
> rid of one but not both, assuming that syntax should reflect semantics
> to this extent. And it's pretty obvious which one to get rid of!
I do not disagree the principle in general. But in this case I think
it is not necessary to have extra syntax of colons when indentation
works very well. So two are redundant, both semicolons and colons.
Even Guido admits requiring colons is redundancy (see here [http://python-history.blogspot.com/2009/02/early-language-design-and-development.html#comments
]); he just thinks this redundancy is good.
More information about the Python-ideas