Earlier quoted context omitted.
Why do you write “you” as “u” here? I don’t want to be rude, but it’s very jarring to see juvenile txt-speak in a serious discussion.
I fully agree, youmanwizard.
Numbering should start at zero (1982)
131–140 of 309 posts
Re: Numbering should start at zero (1982)
#132Earlier quoted context omitted.
So if you go into a bar and order a beer, you drink the zeroth beer before the first?
You would, if English were logical as opposed to being a randomly-evolved cultural practice. With computer languages we have the opportunity to fix the mistakes of the past and do better.
Re: Numbering should start at zero (1982)
#133"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." — Stan Kelly-Bootle
Upshot: if you take the above seriously (proposed by Kelly Boothby), the median proposed by Kelly-Bootle returns to the only sensible choice: zero.
Re: Numbering should start at zero (1982)
#134Earlier quoted context omitted.
You are just citing cultural factors like how we happen to do things in the English language, not any logical argument.
Are there any languages that call the first element the zeroth element in everyday speech? I can't think of one, Google can't come up with one, and neither can ChatGPT. This isn't just cultural; it's universal or almost universal.
Re: Numbering should start at zero (1982)
#135Re: Numbering should start at zero (1982)
#136Re: Numbering should start at zero (1982)
#137Earlier quoted context omitted.
Your visualization makes sense if you always count them going from left to right. But with negative index you naturally count them going from right to left, from the last element backward to the first element. So -0 is the natural starting-point, except it's -1 in python.
-1 is correct, there is no -0. The math works correctly the Python way.
Re: Numbering should start at zero (1982)
#138Earlier quoted context omitted.
Why do you write “you” as “u” here? I don’t want to be rude, but it’s very jarring to see juvenile txt-speak in a serious discussion.
“serious discussion” notwithstanding, I thought the “u’re” was particularly interesting. Why not “ur”? “u” is obviously easier to write, so why worry about properly contracting it? Just interesting imo
Re: Numbering should start at zero (1982)
#139Earlier quoted context omitted.
Are there any languages that call the first element the zeroth element in everyday speech? I can't think of one, Google can't come up with one, and neither can ChatGPT. This isn't just cultural; it's universal or almost universal.
Not zeroth but ground floor vs 1st floor in buildings is common.
In this example, people also call the floor with index 1 the "first floor," although they don't call the ground floor the zeroth floor, as you say.
Since floors can go below ground, the first underground floor is floor -1, so everything works out. There's a floor for every number, unlike with 1-based floor numbering, where floors go from -1 to 1.