Re: [Python-ideas] Making colons optional?
On 5-Feb-09, at 3:36 PM, Andre Roberge wrote:
Yes I agree with you that many people like colons. What bothers me is that some people dislike them, but not given the choice to avoid them. We don't like semicolons in Python, but what would stop a hard-core C users to end every statement with a semicolon? They have the choice.
I have seen *very* few code samples where semi-colon were used - and most were by people just learning Python (and familiar with some other language). If it were up to me, semi-colon would not be allowed - again, for consistency.
Semicolons are bad but are because you'll need them sometimes for one- liners. You can use colons too if you wish. Now the inconsistency is that semicolons are optional but colons are required. I did not propose to eliminate colons all together; just make them optional so we have the choice.
And I would also argue that many of those like colons not because they really feel colons improve readability, but that they have get used to colons in the first place. You like colons, I don't. How do you know another Python user will like them or not? By making trailing colons OPTIONAL, we can probably have the chance to field test. If people really think colons improve readability that much, they can still use them, just like we feel semicolons are line noise and void them if possible, even though we CAN use them. I don't think we will ever lose anything to make colons optional.
The emphasis for Python is improved readability (*perhaps* at the expense of a small extra burden when writing, i.e. when adding colons). I do find code more readable with colons (and have from day 1 when I started learning Python). Apparently you don't. But, if you are given the choice and write code without colons and I read it, I know that it will be less readable for me. So I do disagree with the opinion that we would would not ever lose anything by making colons optional. Either they stay or they are removed - don't allow both.
I agree readability counts. That's why I love Python. And that's also why I don't like colons--they are line noise. Semicolons improve readability; they tell you exactly where lines end (esp. in case of line continuation), in the same way colons tell you where suites end. What do you feel if you see a piece of Python code full of semicolons at the end of every statement? That will probably be the same feeling I have when facing colons at the end of every suite. And unfortunately, we allow both for semicolons.
participants (1)
-
Riobard Zhan