Python Rocks!

Hans-Joachim Widmaier hjwidmai at foxboro.com
Wed Jan 19 09:21:27 EST 2000


"tye4" wrote:
> I'm more concerned with how many maintenance headaches will result if I were
> to accidently add or delete a space on a line. Also, I would to be very
> careful and choosy about what editor to use.. Some editors expand tabs while
> others don't.. What indentation you see in one editor is sometimes different
> to what is seen in another...

Accidently add or delete a space on a line? To me, it looks like you're looking
at it the wrong way: The whitespace in front of the line isn't "spaces" and "tabs",
it's *indentation*. And it's added und deleted not by hitting <BackSpace> or <Del>
4 times but by an editor command "Indent" or "Dedent".
Yes, I'm mixing tabs and spaces, without any problems. I keep tabs at 8, since
every tool I've come across defaults to that. But my editor (vim) distinguishes
between tabs and indentation and keeps me happy all the time. In the rare case
that somebody wants my code, it's easy to filter it through expand.

Every sane programmer indents his or her programs anyway. And all the C programmers
I know were bitten by this old example:

  if (a > 3)
    if (b == 4)
       c = 2;
  else
    c = 3;

Indentation is a way to show the structure of a program to the human reader.
Why do we need a second way to show it to the compiler/interpreter? This only
makes the code ambiguos. What was the programmer's intention in the example
above?
I see the structuring by indentation as one of python's strongest points.

-- 
Hans-Joachim Widmaier         E-Mail:  hjwidmai at foxboro.com
Foxboro Eckardt GmbH          Telefon: +49 711 502 - 397
Pragstrasse 82                Fax:     +49 711 502 - 300
D-70376 Stuttgart 




More information about the Python-list mailing list