× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Op 07-06-10 17:47, Hans Boldt schreef:
Starting indexing at either 0 or 1 is to a great extent an issue of half a
dozen of one, six of the other. It's not just programming languages that
have the issue. Look at the way floors are numbered in buildings. In
Europe, for instance, the first floor above ground level is typically
numbered "1", not "2" as is the practice in North America.
But I have never heard anyone refer to the ground floor as '0th floor'. One might argue that in America all floors are considered equal, while in Britain the ground floor is in a different class :-)
But in programming, there are advantages to 0-based indexing, especially
if you're computing the index of an array element. Mistaking an index as
an offset is probably the biggest source of "off by one" errors.
I have always found it annoying that when a calculation should point to the 6th element of an array, the result of the calculation should be 5. Just a distracting, unnecessary complication.

I don't understand your point about 'mistaking an index as an offset'. I always assumed that C's laughable implementation of arrays (I'm with you, Simon), where the index is effectively the offset, was the source of the zero-indexing.

Regarding white space in Python, it seems to be an issue only for people
who have never done any significant programming in Python. For those who
have, it very quickly becomes a non-issue since the vast majority of good
programmers already practice consistent indentation anyways.
Never did any significant programming in Python; just briefly looked at it, but the idea of using whitespace as control structures immediately struck me as very sensible.

Joep Beckeringh


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.