j: Next unread message
k: Previous unread message
j a: Jump to all threads
j l: Jump to MailingList overview
On 5-Feb-09, at 7:31 AM, Steven D'Aprano wrote:
Riobard Zhan wrote:
Pascal uses colons, but not for the exact same purpose as Python.
Both languages use colons in similar ways to it's use in English. In
particular, Python uses colons as a break between clauses: larger
than a comma, smaller than a period.
Pascal is my first language. It has been some years ago, so I cannot
remember the detail now. I checked wikipedia and did not find colons
are used after if's. Not sure if you mean declarations? If so, I don't
think that is what we are discussing here; Java and C also use colons
in switch/case statements. AFAIK, Python is quite unique in requiring
trailing colons after if's, for's, and function/class definitions.
I'm sorry you dislike colons, but I like them.
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.
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.
I don't think it would lead to any problems, but I think it would
make Python less elegant.
I think omitting colons makes Python more elegant--more uniform, less
clutter. It's an itch every time I see a piece of Ruby code with lots
of def's and if's without trailing colons ...