News for hackers. Stuff that matters.
Re:Why Python uses 0-based indexing. It's because of slices by EpicEng on Wednesday October 23, 2013 @10:04PM (#6602993)
Ignoring the fact that equating what "normal people" would think in contrast to what a trained professional would think in the context of said profession, 1-indexing leads to other problems.

foreach is great, until you need an index. When you do, 0-indexing is more natural. Take, for example, looping over an image.

  unsigned char *buf = get_image();
  for(int y = 0; y < height; ++y) {
    for(int x = 0; x < width; ++x) { 
      // simple
      unsigned char pixel = buf[y * width + x];
    }
  }
That doesn't work when y begins at 1. All of a sudden you need to add and/or subtract 1 everywhere to keep things in line. I used C here, but this applies to many languages in many different circumstances where an index/count is required.
Re:Why Python uses 0-based indexing. It's because of slices by EpicEng on Thursday October 24, 2013 @01:01AM (#6603491)
Can't edit now, but I meant to say:

"Ignoring the fact that equating what "normal people" would think in contrast to what a trained professional would think in the context of said profession isn't always an apt comparison..."