Py3K idea: why not drop the colon?
Georg Brandl
g.brandl-nospam at gmx.net
Mon Nov 13 15:35:29 EST 2006
Michael Hobbs wrote:
> Georg Brandl wrote:
>> Ron Adam wrote:
>>
>>> 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.
>>>
>>
>> Special cases aren't special enough to break the rules.
>>
>> Georg
>>
>
> Eh? So multi-line strings are special enough to create a new syntax,
> like, say, triple-quoted strings? Very long expressions aren't special
> enough to create a special backslash token to continue the expression on
> the next line? Multiple short expressions aren't special enough to
> create a special semi-colon token to combine them on a single line?
For me, the above are not special cases in the sense that "leaving off the
line continuation character is allowed only in the line beginning a new suite"
is.
A similar special case would be, e.g., if triple quoted strings were
automatically dedented, but only if there's no text between the opening
quotes and the first linebreak. Etc. etc.
> Programming language design is nothing more than deciding the best way
> to deal with special cases. That even includes Lisp.
Of course. This is why the Zen includes more than one statement.
Georg
More information about the Python-list
mailing list