Regarding the naming of variables, this is another topic that can easily lead to programmer debate. How can the naming be more readable, easy to write, and clear? There are many opinions.
In this story of “Why Python” series, we will focus on the connection method in variable namings:
The question we want to answer is- why does Python recommend the snake-like nomenclature?
First of all, for single characters or words (for example A, PYTHON, BOY), when they are used as variable names, there are roughly all lower case, all upper case, and first letter upper case.
However, programming languages usually need to use multiple words or symbols to express a richer meaning in variable names**. **English is used to using spaces to separate words, but this usage will cause some trouble in the programming language, so programmers have created other methods:
In general, these nomenclatures are to overcome the spaces between words and to connect them, and finally achieve the effect of creating a new “word”.
If you rank according to the number of audiences and popularity, there is no doubt that the top two names are camel nomenclature and snake-case nomenclature.
We can simply compare their advantages and disadvantages:
Readability:
Ease of writing
#towards-data-science #technology #python #python3 #programming