Riobard Zhan schrieb:
On 5-Feb-09, at 10:04 AM, Christian Heimes wrote:
Please keep Python sources readable.
Please elaborate (better yet, give concrete examples) why it makes Python code less readable.
The reason I propose to make colons optional is that I fail to see colons make code more readable. They seem to be line noise to me. You might disagree, but please explain why.
The colon at the end makes it clear it's the end of the statement, too.
def method(self, some, very, long, method, going, over, lots, and, lots, and, lots, of, lines): pass
The second example makes it even more obvious:
if (some() and some_other() or some_more(complex=(True,)) and a_final_call(egg=(1,2,3))): do_something()
You see a line starting with "if" but not ending with a colon. You know for sure that you have to search for a trailing colon in order to find the end of a very long "if" line.
Yes, the colon is extra noise but it's the kind of good noise that makes life more joyful like the noise of rain on a roof. Did you notice that I'm using a colon in my regular postings, too? I've used two colons to separate my text from the examples. Colon separators are natural to me.