Re:Why Python is Slow: Looking Under the Hood (2014)
by billfruit on Wednesday October 25, 2017 @10:08AM
(#15550216)
Precisely the opposite reason R drove me away. R uses 1 based indexing.Seriously we should all be using Zero based indexing for all purposes.
[ Parent
| on HN ]
Re:Why Python is Slow: Looking Under the Hood (2014)
by peatmoss on Wednesday October 25, 2017 @11:17AM
(#15550814)
One can make an appeal to aesthetics, but that’s no differentiator.
Or one could appeal to adherence to existing standards. Fortran is the oldest (portable) programming language and was 1-based.
Or one could appeal to consistency with the problem domain. Again, math [EDIT: indices are] 1-based.
Zero-based is consistent with C, but that’s about the best argument I can make for zero-based.
Re:Why Python is Slow: Looking Under the Hood (2014)
by billfruit on Wednesday October 25, 2017 @11:05PM
(#15556046)
I think Dijkstra established the case for using Zero based indexing strong enough: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...
Re:Why Python is Slow: Looking Under the Hood (2014)
by DonbunEf7 on Wednesday October 25, 2017 @12:11PM
(#15551373)
Maths is zero-based. I'm not sure why you think that numbers start with one; every formulation of the integers in modern maths starts with zero.
Re:Why Python is Slow: Looking Under the Hood (2014)
by peatmoss on Wednesday October 25, 2017 @12:18PM
(#15551446)
Matrices, common in statistics because of applications of linear algebra, have long maintained the convention of i,j indexes starting with one.
Re:Why Python is Slow: Looking Under the Hood (2014)
by dnautics on Thursday October 26, 2017 @12:12AM
(#15556288)
It's not. Zero based is wise for offsets (CS) and fields where you have a zero element, and a few corner cases like factorial, but by and large any time you're enumerating an order over a nonempty set you start with one in math, because, max(indices) = |set|
Re:Why Python is Slow: Looking Under the Hood (2014)
by baldfat on Wednesday October 25, 2017 @06:08PM
(#15554740)
0 based was only for programming for iterations. This makes it a weird math for people. When the first column is 0 and 1 is the second column it is indeed weird and is why statistical languages are 1 based.