Default indentation of 4 columns

Tim Peters tim_one at email.msn.com
Mon Oct 25 02:50:11 EDT 1999


[pinard at IRO.UMontreal.CA, seeking to be told what to do <wink>]
> ...
> Indeed.  INDENT/DEDENT considerations, or explanations about
> Python logical construction of single lines from physical lines,
> are a bit extraneous!

But not to python-mode or IDLE:  mechanical crap like that is all they know
about.  Exercise your right to be human <0.9 wink>.  Regardless of what you
think the style guide is recommending, Guido generally continues long "if"
and "while" tests with backslashes, unless an open paren just happens to be
present naturally when the end of the first line is reached.

> ...
> Somewhere else, Guido insists that we should not use extraneous whitespace
> for lining up things (assignments given as examples), somewhat suggesting
> that we should keep the spacing simple, and not invent spaces just for
> the sake of building an overall look.

Yes, some of his recommendations *are* wrong <wink>.  The specific example
he gives is extreme (although not nearly as extreme as I've seen in actual
code!), inserting a dozen spaces repeatedly to make a long variable name
line up with a bunch of short ones.  This looks silly -- it doesn't help.
It *can* improve readability for identifiers close to the same length, as in

    x  =   3.005
    dx = -12.500
    y  =   7.147
    dy = 145.002

There I not only lined up the equal signs, but also the decimal points, and
padded the "short" number with extra zeroes.  Does Guido like that?  I don't
care!  He's not maintaining my code, it's not extreme, and it helps me.  So
there.

> As I see it, there is some peeking inconsistencies in these suggestions,

The subtitle of the essay is "A Foolish Consistency is the Hobgoblin of
Little Minds" -- reread the second paragraph.  Inconsistency can be helpful
too.

> which are sometimes strongly formulated.  We could surely make religious
> debates trying to explain everything (we say "exégèse" in French for that
> science which interprets religious texts :-).

Exegesis in English -- can't you French come up with any of your own words
<wink>?

> My overall feeling is that the guide is not fully satisfactory as
> it stands. ...

This is a topic for théodicée (English theodicy):  how can Guido be both
good and omnipotent if evil exists?  The usual answer applies:  if He spared
us every uncertainty and unsatisfied appetite, it would be tantamount to
nullifying our free will.  There can be no triumph without struggle in the
face of adversity, be it in saving one's soul or making indentation look
pretty <wink>.

salvation-thru-whitespace-ly y'rs  - tim






More information about the Python-list mailing list