Larry Wall's comment on python...

Jacob Hallen jacob at boris.cd.chalmers.se.cd.chalmers.se
Wed Sep 25 10:00:43 EDT 2002


In article <3D87402E.6020700 at thinkware.se>,
Magnus Lyckå  <magnus at thinkware.se> wrote:
...
>My personal experience from many years of coding C++ etc
>with curlies and Python without, is that I tend to get
>lost a lot more in my C++ code than in my Python code.
>Not to mention the code of others... I've certainly had
>a number of debugging sessions where I had to help some
>mediocre C++ coder who couldn't match his own braces...
>The problem is usually that the blocks get to big... The
>fact that you can get away with incorrect indentation in
>the brace-languages makes it worse.
>
>Most modern editors have tools like indentation guides and
>folding that can make it easier to see block structures.
>
>Was it one of Beethoven's symphonies that ended so abruptly
>that the audience didn't understand when to applaud? It was
>considered a big failure at it's time, and it's considered
>one of the best works of a genious today...

I think there is a good explanation for why code with explicit delimiters
is harder to read and follow than normal Python code.

There is an absolutely outstanding series of books by Edward Tufte
about how to create charts, tables and other information presentation
graphics. In his books he introduces a measurable unit called "Chart junk".
This is the percentage of the ink used in the chart that does not convey
information. Ink does not convey information if it can be erased, or
if by changing the position of other ink in the diagram, you can leave the
ink out.

Tufte then goes on to practically show that the unit is a relevant one to
ease of understanding. The books are beautiful and should be required reading
for anyone who ever designs a user interface.

In any case, I think that there exists something we can call source-junk, which
is the programming language equivalent of chart-junk. It is all the "ink"
in the source code that does not add to your understanding of what the code
does. Block starts and ends can be represented by white areas. Redundant
parenthesis can be thrown away. Declarations are seldom needed by the
programmer in order to understand the program.

The most important parts of your program, for understanding how it works
is the names of your objects (variables, classes, methods, functions, modules).
Second to that is the operations you do on your objects - how you combine
them. That's about it. Please note that I didn't say anything about block
delimiters or parentheses in this. I think they were put into programming
languages to make it easy to write fast compilers. I also think that
one of the factors making C so popular was that the BEGIN/END of Pascal and
ADA were even more intrusive than {}, so people considered C to be much
more readable than the competitors.

The lack of source junk is certainly the biggest thing that attracts me to
Python. The rest of the benefits are fairly pedestrian. This one is the
really big win.

Jacob Hallén

A


-- 



More information about the Python-list mailing list