Re: python for loop



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

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
.



Relevant Pages

  • RE: Dependency problems
    ... I know that the project is being rebuilt because I see the output in the ... it will not be built. ... Also, for .NET projects, I know that as long as the project has not been ... are you checking the file update date of the output file ...
    (microsoft.public.vsnet.general)
  • Re: Keswick
    ... Transport understand as no-one has recently built or rebuilt a simple ... line such as ours on a closed construction site. ... or rebuilt a simple line such as ours on a closed construction site" ...
    (uk.railway)
  • Re: web pages only show as files
    ... G'day DavidF ... When I rebuilt the pages in Pub 2003, they were completely new pages - text, ... I built my web pages in Pub 98 with no problems at all - they published ... When I got Publisher 2003 I built a new set of web pages - all worked ...
    (microsoft.public.publisher.webdesign)
  • Re: Aged 7 again
    ... hopping on and off at various stops, on the paddle steamer Gallia, ... built in 1913 and rebuilt in 2001/2004. ... Walking into the 2nd class saloon was like being 7 years old. ...
    (uk.rec.sheds)
  • Re: The truth about Lousiana - There Was Nothing ANYONE could do
    ... >>rebuilt, and built new dikes that will withstand major storms and ... > Of course, the Dutch dikes, like our California levees, mostly protect ... The cities all predate the dikes, and are built on higher ...
    (rec.motorcycles)