📜 ⬆️ ⬇️

List Revolution. Numbering lists starting from one? Consider already done! [UPD]

Recently, on the Internet, I came across this message from the python community mailing list:
Christopher King: The first item in the list has an index of 0, the second has an index of 1, the third is 2, and so on. Sometimes this is confusing for beginners python and programming in general. This numbering system was adopted at a time when 1 bit was still of great importance. It's time to upgrade. Keep in mind that this proposal is for the fourth version, because it will not have backward compatibility. I say that we have to make the first element with index 1, the second with index 2, etc. Other languages ​​will follow. We want to make the python easy and readable, and in an era when you can’t get anything less than a kilobyte via USB, we have to make the first one, the second one second, and the third one third, as it should be. I give this a "+1".
Guido van Rossum: Consider it already done.
* Guido van Rossum is the author of the Python programming language, his BDFL .
Original on mail.python.org , discussion .

The community, as it was supposed, reacted to this ambiguously: from “I can’t believe that I haven’t thought of it myself before,” to “this is complete madness!”. Began to deepen the technical implementation of this idea. The author of the proposal was genuinely surprised by Guido’s approval, since he perceived his idea more as a joke. True, after a few days, the lifelong dictator still came to his senses:

Guido van Rossum: ... In any case, your idea will not fly, let alone whether this idea is a good idea for the design of a new language. All code written over the more than 20 years of python’s existence should be changed, not to mention the brains of millions of users and hundreds of books about python.
Plus, almost all other widely used programming languages ​​(C, C ++, Java, C #, JavaScript, Ruby, Objective C) start indexing from scratch.
This is an ideological battle that has been fought for a long time (all old programming languages ​​support indexing based on 1: Fortran, Algol, Pascal), and indexing won from 0, and this is actually not so important by and large, so the “status quo” wins .

Nevertheless, the idea is still being discussed, and it has quite a few influential and respected supporters in the community.
')
This proposal plunged me into violent reasoning: on the one hand, this seemed to be more “humane”, but what about the backward compatibility of the old code, not to mention the conflicts in the presentation of data for / from other programming languages? If this feature is implemented in Python 4, it can become both a highlight of python and hell. Personally, I tend to the second. What does the habrasoobshchestvo say about this?

UPD. For those who took everything too seriously: no one will enter indexing from Python in any way, the hysteria will be canceled. We read the second answer Guido .

Source: https://habr.com/ru/post/129210/


All Articles