Py3K idea: why not drop the colon?
Michael Hobbs
mike at hobbshouse.org
Mon Nov 13 13:50:40 EST 2006
Carsten Haese wrote:
> On Sat, 2006-11-11 at 23:18 -0800, Doug wrote:
>
>> Michael Hobbs wrote:
>>
>>> I think the colon could be omitted from every type of compound
>>> statement: 'if', 'for', 'def', 'class', whatever. Am I missing anything?
>>>
>>> Thanks,
>>> - Mike
>>>
>> It is a very good idea as the colon is technically redundant (not
>> necessary for parsing, aside from one liners) and actually hurts
>> readability (and writeability). The "evidence" people cite for the
>> advantage of using a colon is research done by users of the ABC
>> language, python's predecessor. They forget that A) that was like 20
>> years ago,
>>
>
> Research being old does not automatically invalidate it. Old research is
> invalidated by newer research that invalidates it.
>
>
No, old research does is not automatically invalidated, but
out-of-context research is. I'm sure there's research somewhere proving
that code written in ALL UPPERCASE is preferable, since it makes
punched-cards easier to read by humans. Python 1.0 may have been a nice
language for "newbies", with a lot of similarities to ABC, but there has
been a lot of evolution since then. Sure, it's still very easy to teach
basic Python, but if you're concerned about readability, take a look at
any real-world Python app or library. You'll find it's filled with
things such as "__getattr__", "__repr__", "__nonzero__", and
"super(MyClass, self).__init__()". Hardly newbie stuff.
I think waving the banner of ABC simplicity in the context of Py3K is
about as applicable as complaining that an RSS aggregator isn't written
in assembly. (An RSS aggregator is so far beyond being CPU-bound that
it's pointless to argue which language it should be written in.)
- Mike
More information about the Python-list
mailing list