Py3K idea: why not drop the colon?

Steven D'Aprano steve at REMOVEME.cybersource.com.au
Wed Nov 15 08:12:32 CET 2006


On Tue, 14 Nov 2006 12:01:05 +0000, Antoon Pardon wrote:

> On 2006-11-13, Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:
>> Michael Hobbs <mike at hobbshouse.org> writes:
>>
>>> To be clear, this is the actual thrust of my argument. It seems
>>> redundant to have *both* line continuations and colons in compound
>>> statements.
>>
>> Why are you trying to remove redundancy?
> 
> Why not? My impression is that removing redundancy is considered
> a positive thing here in c.p.l.

Redundancy in *what*?

Redundancy is not something to be valued for its own sake. It is only
valuable when it actually gains you something.

e.g. x + y and x.__add__(y) are redundant, BUT __add__ is necessary for
operator overloading and + operator is necessary for readability and
easy arithmetic expressions.

Likewise, operator.add is useful for local optimizations, and so is to be
valued despite the redundancy of yet another way to do addition.

But a hypothetical built-in function add(x,y) => x+y would be redundant
for no good reason, and therefore to be resisted.

The question is not "is the colon redundant?" but "is the colon useful
despite, or even because, its redundancy?". There are two schools of
thought:

(1) Yes, it is useful, *because* of its redundancy -- it helps the human
reader parse and comprehend the source code.
Evidence given: usability studies by the ABC project.

(2) No, it is not useful, because the computer parser doesn't need it.
Evidence given: "it seems to me" repeated loudly until our ears bleed.

People's intuition is notoriously poor at judging usability. I don't say I
give it zero credence, but I give it very little.


-- 
Steven D'Aprano 




More information about the Python-list mailing list