|
|
|
|
|
by red-tea
2798 days ago
|
|
> or any other kind of offset that you so desire This is too often the attitude of Julia people. But zero-based indexing is not just some arbitrary offset. Programmers just like it. You say that many things are more intuitive with one-based indexing, but many things are less intuitive too. I don't think python ever would have become popular without zero-based indexing. The thing is, we really don't know why people prefer certain types of language. All we know is that they do. Computer languages can't evolve gradually like natural languages, but if they could I really don't think we'd go to one-based indexing. |
|
And it's a good attitude for the Julia people to have. Their target audience is not just (or even mainly) full time developers. They're targeting scientists, statisticians etc. As such, it makes sense for Julia to use conventions that are appropriate to their audience. This pervades the whole of Julia, not just indexing although the latter is exceptionally rich for this reason.
> Programmers just like it
That's a reason for having 0-based indexing but not an especially good one. And for Python it was an arbitrary decision. That's not to say that 0-based indexing is necessarily an arbitrary decision, it wasn't for C, for example, but it often is.