Mailinglist Archive: opensuse (1473 mails)

< Previous Next >
Re: [opensuse] editor that does not eat out TAB characters
  • From: nordi <nordi@xxxxxxxxxxxx>
  • Date: Tue, 16 Jun 2009 02:04:33 +0200
  • Message-id: <4A36E191.2090903@xxxxxxxxxxxx>
Maura Monville wrote:
I tried to run the python script step-by-step.
Have you tried pdb for that? A very nice introduction can be found at
[1], plus some links. That is probably better than copy and paste
anyway, because you would always have to copy and paste all "import"
statements before code snippets can work.


I am appalled at a modern object-oriented language that is built on a suyntax
which is sensistive to indentation !
This is not a bug, it is a feature. It forces programmers to use
indentation, and to use it consistently. That means all Python programs
are indented the same way (=easy to read).

Also, you don't have to explicitly mark blocks with {..} or do...done or
whatever as in other languages. This explicit marking and the
indentation have redundant info about the program structure: One is for
the compiler/interpreter, one for the human. But redundancy can lead to
inconsistency, e.g. a programmer writing
if (foo == 1)
bar();
foobar();
For the human eye, foobar() belongs to the if statement. For the
compiler it does not, because there is no {...}. This kind of mistake
cannot happen in Python, because syntactically, what you see is what you
get. Removing the redundant info also makes it easier to read the code,
because there is simply less to read.

So using indentation as part of the syntax makes programs easier to read
and eliminates an entire class of programming errors.


Regards
nordi


[1] http://www.ferg.org/papers/debugging_in_python.html


--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups