Re:Why Python uses 0-based indexing. It's because of slices
by dpratt on Wednesday October 23, 2013 @06:31PM
(#6602208)
I'm just thinking logically - not even on a pointer level. If I'm doing index/offset math to calculate an array position, it's foolish to start at 1 instead of 0.
[ Parent
| on HN ]
Re:Why Python uses 0-based indexing. It's because of slices
by anonymoushn on Wednesday October 23, 2013 @06:37PM
(#6602230)
Adding things that aren't conceptually indices to indices works the same way in both conventions (so a[idx] and a[idx+k] have k-1 things in between). You miss out on stuffing multiple dimensions into one with a[x*xlen+y], but there's generally no reason to do that.
Could you elaborate about the uses you have in mind?.