4 ms·
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." -- Stan Kelly-Bootle
by paulmd 7y ago
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."
-- Stan Kelly-Bootle
- travisjungroth 7y agoI made a Python library that implemented this and gave a talk about it at PyCon: https://www.youtube.com/watch?v=yC9m2GInXqU&feature=youtu.be&t=330/ https://www.youtube.com/watch?v=yC9m2GInXqU&feature=youtu.be...
- andai 7y agoGave me a good laugh, thanks for this :) https://github.com/travisjungroth/Compromise https://github.com/travisjungroth/Compromise
- thijsvandien 7y agoIt's at 5:30.
- yesenadam 7y agoSo silly. I love it. The thing most worthy of the name "Python" I've seen, by a mile.
- BubRoss 7y agoIndices should start at 1, but in programming we mostly use offsets and call them indices which is one source of confusion that leads to this endless debate.
- gautamdivgi 7y agoA real problem and pretty sure quite a few bugs in mathematical toolsets happen because of this. It was a real pain translating formulae to code for numerical computing.
- mc3 7y agoRelevant xkcds: https://xkcd.com/394/ https://xkcd.com/394/ https://xkcd.com/1292/ https://xkcd.com/1292/
- GuB-42 7y agoThere is worse. In Perl, you have the global variable $[, which lets you specify the first index of an array. One could imagine setting it to 0.5. I don't thing that would work, but with Perl being Perl, we never know. This is, of course, a terrible idea, and that feature is now deprecated. $[ is always 0 and setting it to any other value is an error.
- Kaiyou 7y agoThings would be so much simpler if they start at 0, but with 0 being reserved for the length the array is supposed to have.
- oarabbus_ 7y agoThings would also be so much simpler if everything started at 1.
- kps 7y agoSadly missed. Stan Kelly-Bootle was the first person to get a postgraduate degree in computer science. For more with the flavour of the quote above, check out his Devil's Advocate column in UNIX Review¹ magazine (not much UNIX, promise) and the post-paper Son of Devil's Advocate.² ¹ https://archive.org/search.php?query=creator%3A%22Unix+Review+Magazine%22 https://archive.org/search.php?query=creator%3A%22Unix+Revie... ² https://web.archive.org/web/20161024171031/http://www.sarcheck.com/skb/index.htm https://web.archive.org/web/20161024171031/http://www.sarche...