Python "why" questions
steve at REMOVE-THIS-cybersource.com.au
Sat Aug 7 16:10:29 CEST 2010
On Sat, 07 Aug 2010 08:54:28 -0400, D'Arcy J.M. Cain wrote:
> On Sat, 07 Aug 2010 13:48:32 +0200
> News123 <news1234 at free.fr> wrote:
>> It makes sense in assembly language and even in many byte code
>> languages. It makes sense if you look at the internal representation of
>> unsigned numbers (which might become an index)
>> For a complete beginner common sense dictates differently and there
>> might be confusion why the second element in a list has index 1.
> Would said beginner also be surprised that a newborn baby is zero years
> old or would it be more natural to call them a one year old? Zero based
> counting is perfectly natural.
There's nothing natural about saying that a baby is zero years old. A
newborn baby is "a newborn baby", then it's "one day old", "two days
old", ... "one month old", "two months old", ... "one year old".
In any case, we're discussing *ordinals*, not cardinal numbers. The
ordinals in common English are first, second, third, ... but in computing
frequently zeroth, first, second, third, ...
There is a reason why mathematicians describe the integers 1, 2, 3, ...
as the "Natural Numbers". It took thousands of years of human
civilization before people accepted that zero was a number. In fact, for
the ancient Greeks, one wasn't a number either. We still reserve the term
"a number of X" to refer to more than one X, and would feel cheated if
somebody offered us a number of gifts and then gave us only a single one.
"Number" refers to a plurality, and one is singular.
According to Euclid, one was the monad, the indivisible unit from which
the numbers were formed. As late as 1537, the German mathematician Jacob
Kobel wrote "1 is no number, but it is a generatrix, beginning and
foundation for all other numbers".
In short, there's nothing natural about counting numbers at all, let
alone whether we should start at 0 or 1.
P.S. I don't know if I should be gratified or disappointed that nobody
has yet quoted Stan Kelly-Bootle:
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected
without, I thought, proper consideration."
More information about the Python-list