do people really complain about significant whitespace?

Carl Banks pavlovevidence at gmail.com
Wed Aug 9 10:48:22 EDT 2006


Pierre Barbier de Reuille wrote:
> Problem being : grouping by indentation do *not* imply good indentation.

By itself, it doesn't.  But with grouping by indentation, bad
indentation no longer results from mere carelessness, which is no small
thing.

Although Python doesn't do this, it is possible to mandate a specific
indent (4 spaces, say), or at least a reasonable consistent indent,
which would indeed all but guarantee good indenting.  (I say "all but"
only to account for deliberately misleading code, perhaps using clever
line breaks and comments.)


> For example, I had to read a piece of (almost working) code which looked
> like that :
>
>   if cond1 :             stmt1
>                          stmt2
>                          stmt3
>       if cond2:          stmt4
>                          stmt5
>       elif cond3:        stmt6
>                          stmt7
>   else:                  stmt8
>                          stmt9
>                          stmt10
>                          stmt11
>
> So you can tell what you want, but this code is valid but impossible to
> read and impossible to reindent correctly. So although I personnaly like
> Python, I still don't think meaningful indentation is good.

Even if this were legal code (it isn't), it's still more transparent
than some of the C code I've seen.


Carl Banks




More information about the Python-list mailing list