python for loop

Rhodri James rhodri at
Wed Apr 1 05:39:26 CEST 2009

On Wed, 01 Apr 2009 03:58:48 +0100, Lada Kugis <lada.kugis at>  

> I thoughts high level languages were created primarily so we don't
> have to think about what happens inside a programming language, memory
> offsets and the like.

Different programming languages were created for different purposes.
FORTRAN was built (and rebuilt, and rebuilt again) for crunching
numerical data, and there are only a limited number of ways that
"knowing what's going on under the hood" will help you write better
programs.  C, on the other hand, was built for writing tools for
Unix.  It gives you very little insulation from what's going on
inside, and knowing about that can be critical to the efficiency of
your programs.

> Why do we try to create languages that are intuitive to humans, then ?

To attempt to minimise the number of mistakes our intuition would
otherwise cause.  Which rather begs the question of how varied intuition
is, and where that causes clashes we have to retreat to that unintuitive
beast, logic.

Dragging this back to the original topic, you clearly find starting
list indices from zero unintuitive.  To me, with a mathematical
background, it's not just intuitive, it's correct.  All sorts of
useful properties fall out from that, not the least of which is
the fact that "a[0:len(a)]" slices the whole of a list.  You want the
first three items of a list?  "a[:3]" will do nicely, sir.  With
1-based indexing you start having to apply offsets in nonintuitive
ways more often than you might hope.

Rhodri James *-* Wildebeeste Herder to the Masses

More information about the Python-list mailing list