Python "why" questions
Steven D'Aprano
steve-REMOVE-THIS at cybersource.com.au
Thu Aug 19 03:52:30 EDT 2010
On Wed, 18 Aug 2010 21:55:30 -0700, Russ P. wrote:
> On Aug 18, 7:58 pm, Steven D'Aprano <steve-REMOVE-
> T... at cybersource.com.au> wrote:
>> On Wed, 18 Aug 2010 14:47:08 -0700, Russ P. wrote:
>> > Is the top team in the league the number 1 team -- or the number 0
>> > team? I have yet to hear anyone call the best team the number 0 team!
>>
>> Why is the top team the one with the lowest number?
>
> How could it be otherwise? What is the highest number?
If there are N teams, then the highest number is obviously N (if counting
from 1) or N-1 (if from 0).
In other words... why do we rank sporting teams Best to Worst rather than
the other way around?
[...]
> Maybe "goofy" was too derogatory, but I think you are rationalizing a
> bad decision, at least for high-level languages. I don't think
> programming languages should always mimic human languages, but this is
> one case where there is no advantage to doing otherwise.
>
> Why do you think "off by one" errors are so common? Because the darn
> indexing convention is off by one!
But you have that exactly backwards. Counting from 0 leads to fewer off
by one errors for many tasks.
(Of course, avoiding indexing in favour of iteration leads to even fewer
off by one errors.)
Anyway, in a feeble attempt to move this discussion somewhere --
anywhere! -- else:
http://c2.com/cgi/wiki?FencePostError
http://c2.com/cgi/wiki?WhyNumberingShouldStartAtZero
http://c2.com/cgi/wiki?WhyNumberingShouldStartAtOne
http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/zero
and of course:
http://xkcd.com/163/
--
Steven
More information about the Python-list
mailing list