Possibly because I learnt programming in Fortran and Pascal, starting an index with 0 and the syntax of Python range statement had seemed unnatural to me. So, it was nice to come across Dijkstra's Why numbering should start at zero.
Now, I am a convert and nice to unlearn Fortran.
"Adhering to convention a) yields, when starting with subscript 1, the subscript range 1 ≤ i < N+1; starting with 0, however, gives the nicer range 0 ≤ i < N. So let us let our ordinals start at zero: an element's ordinal (subscript) equals the number of elements preceding it in the sequence. And the moral of the story is that we had better regard —after all those centuries!— zero as a most natural number."
Saturday, March 13, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment