Python is readable
Thu Mar 15 16:05:58 CET 2012
On 3/15/2012 15:48, Chris Angelico wrote:
> On Fri, Mar 16, 2012 at 1:30 AM, Kiuhnm
> <kiuhnm03.4t.yahoo.it at mail.python.org> wrote:
>> Sorry, but I can't see how it would make it harder for humans to understand.
>> Are there particular situations you're referring to?
> In a trivial example, it's mostly just noise:
> if a == b # who needs the colon?
> But when your condition is more complicated, it's cleaner to
> explicitly mark the end of the condition. Also, Python allows you to
> put a simple body on the same line as the if, which is very handy:
> if a == b: print(c)
> Without the colon, this would be awkward to parse. And the bash style
> of using actual statement separators feels really weird, although it
> does mean that the newline is truly optional.
I had thought about the single-line case. What I hadn't thought about is
that Python strives to be as regular as possible, so having different
cases just for saving one keystroke isn't worth it.
More information about the Python-list