Michael Hobbs wrote: > The same problem that is solved by not having to type parens around the > 'if' conditional, a la C and its derivatives. That is, it's unnecessary > typing to no good advantage, IMHO. I was coding in Ruby for several > months and got very comfortable with just typing the if conditional and > hitting return, without any extra syntax. When I came back to Python, I > found that I felt annoyed every time I typed the colon, since it > obviously isn't required. The FAQ says that the colon increases > readability, but I'm skeptical. The indentation seems to provide more > than enough of a visual clue as to where the if conditional ends.
I'm not sure why '\'s are required to do multi-line before the colon. Possibly because if multi-line conditional expressions are the norm, dropping a colon could result in valid (but incorrect) code instead of an error? The faq also pointed out a technical reason for requiring the colon. It makes the underlying parser much easier to write and maintain. This shouldn't be taken to lightly in my opinion, because a simpler easer to maintain and more reliable python parser means development time can be spent improving the language in other areas instead of fixing parsing problems every time a new feature is added that might be used in a conditional expression. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list