Python is readable

Chris Angelico rosuav at gmail.com
Sun Mar 18 18:02:06 EDT 2012


On Mon, Mar 19, 2012 at 8:30 AM, John Ladasky <ladasky at my-deja.com> wrote:
> What I would say is that, when PROGRAMMERS look at Python code for the
> first time, they will understand what it does more readily than they
> would understand other unfamiliar programming languages.  That has
> value.

This is something that's never truly defined. Everyone talks of how
this language or that language is readable, but if you mean that you
can look at a line of code and know what *that line* does, then Python
suffers badly and assembly language wins out; but if you mean that you
should be able to glance over an entire function and comprehend its
algorithm, then I have yet to see any language in which it's not
plainly easy to write bad code. Even with good code, anything more
than trivial can't be eyeballed in that way - if you could, what would
docstrings be for?

Really, the metric MUST be Python programmers. Intuitiveness is of
value, but readability among experienced programmers is far more
useful. If I write a whole lot of code today, and next year I'm dead
and someone else has replaced me, I frankly don't mind if he has to
learn the language before he can grok my code. I _do_ mind if, even
after he's learned the language, he can't figure out what my code's
doing; and that's where Python's placed itself at about the right
level - not so high that it's all in airy-fairy conceptual work, but
not so low that it gets bogged down. There's a handful of other
languages that are similarly placed, and they're the languages that I
would call "readable".

Here's an analogy: One statement (aka line of code, etc) corresponds
to one sentence in English. Massive one-liners are like some of the
sentences in Paul's epistles; assembly language is like "The cat sat
on the mat". Both are valid; both are hard to read.

There, have fun tearing thaat to shreds :)

ChrisA



More information about the Python-list mailing list