Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
last index
#4
(Jul-31-2019, 01:27 PM)paul18fr Wrote: I cannot tell about the potential advantages of starting with 0, but it's sometime confusing (probably a question of pratice).
(on that specific topic, other languages are more "natural" in my opinion)

Question: is your age confusing or less-natural? Because you are born 0 years old, not 1 year old. Are you confused while calculating your age because it's starts with 0 and not with 1? Probably not Smile

Some relevant pieces of information regarding zero based index:

Why Python uses 0-based indexing by Guido van Rossum

Dijkstra's legendary Why numbering should start at zero (handwritten version)

and finally real reason why 0-based indexing is used:

Quote:So: the technical reason we started counting arrays at zero is that in the mid-1960’s, you could shave a few cycles off of a program’s compilation time on an IBM 7094. The social reason is that we had to save every cycle we could, because if the job didn’t finish fast it might not finish at all and you never know when you’re getting bumped off the hardware because the President of IBM just called and fuck your thesis, it’s yacht-racing time.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
last index - by paul18fr - Jul-31-2019, 08:35 AM
RE: last index - by ichabod801 - Jul-31-2019, 01:13 PM
RE: last index - by paul18fr - Jul-31-2019, 01:27 PM
RE: last index - by perfringo - Jul-31-2019, 05:10 PM
RE: last index - by paul18fr - Jul-31-2019, 08:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Getting Index Error - list index out of range krishna 2 2,698 Jan-09-2021, 08:29 AM
Last Post: buran
  Getting Index Error - list index out of range RahulSingh 2 6,245 Feb-03-2020, 07:17 AM
Last Post: RahulSingh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020