Natural language is full of ambiguity, which is why my parents used to
argue about the meaning of "next Wednesday," or of "the next exit."
Until you have a starting reference, and until you decide whether it's a
closed or open interval, you can't be sure everyone will get the same
semantics. Because of their bickering 50 years ago, I try to use a
longer phrase, such as "the Wednesday a week from today" or "exit 52."
In most? of Europe, the first floor is the one you get to after you go
up one flight of stairs. In the US, first floor is usually the ground
floor.
My ruler starts at zero, and has an explicit zero on it. Most rulers
start the same way, but don't actually show the zero. But if you had a
ruler that started with one, you'd end up with some off-by-one errors.
I repeatedly see people think that if Joe has $100, and Mary has three
times more, that she has $300. Yet these same people would balk at the
notion that 10% more would be $10.
English is a funny language (as I suspect most languages are), and full
of ambiguities and foolish inconsistencies. Having worked with some 35
languages over 35 years in the industry, I was glad that most of them
were zero based.
Steven D'Aprano wrote:
On Wed, 01 Apr 2009 04:39:26 +0100, Rhodri James wrote:
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.
But some non-useful properties fall out of that too.
Want the fifth item? a[5] gives you the *sixth* item, which is weird, so
you have to use a[5-1] to get the fifth item.
There is a major clash between the names of ordinals in human languages
and zero-based counting. In human languages, the Nth-ordinal item comes
in position N. You can keep that useful convention with zero-based
counting by inventing the ugly word "zeroth", but that just leads to
bizarro-talk like "the zeroeth item comes first, the first item comes
second, and so on".
a[0:len(a)] is legal, a[0] is legal, but surprisingly a[len(a)] is an
error.
Despite coming from a Pascal background, I've come to appreciate and
prefer zero-based indexing for programming. But I'm not blind to the
disadvantages. I'll often work out an algorithm using pencil and paper
and counting from one, and then subtract one to get zero-based indexes.
There are advantages and disadvantages to both systems, but on balance, I
think that zero-based is a better system for programming, and one-based
for natural language.
--
http://mail.python.org/mailman/listinfo/python-list