Integer division
As you know, in Python there are two ways to share integers:
The operator / when dividing the whole number to the whole returns the result of the type Float.
And the operator // when dividing the whole, returns the whole with rounding down, in English this operator is also called Floor Division.
I dug in the history of the language and found out that initially the division of integers in Python was only integer, and for him Guido used the symbol /. But it quickly became clear that in a language where the programmer does not declare the types clearly, the use of such a symbol is inconvenient and will lead to an abundance of errors in the programs.
Therefore, part of the community (including Guido) insisted that the operator of integer division needs to choose a symbol //, and the division operator that returns the type of Float should be /. Other developers said that the integer division should be written as /, arguing this by the fact that “learning to deal with integer division is as a rite of initiation for beginner programmers”, and in CE -integrated division is written just like that.
Here's what Guido writes about this in his blog (in my free translation):
To hear the opinion of a person far from programming, I asked my friend, who was engaged in medieval English literature. The conversation was about this:
Me: Here you take two whole numbers. Ho#Osho?
Me: Now you can add them, subtract, multiply in the program, right?
Me: Now suppose you divide them ...
She: But this makes no sense! Entire numbers form a ring, not a field. You said that you took these numbers from Z, right?
That's all. This is the point of view of the non -programmer (with whom it is convenient for me to agree). The integer division is nonsense and it does not need to be written as "/", even if they do this in C ;-)
Indeed, from the point of view of non -gramist, integer division is a rather strange story, because there are no divisions in principle over integer, like the matrices!
Sources: [1], [2].
#machinelearning #articalIlinTelling #ai #DatAstascience #PROGRAMMMING #TECHNOLOGY #DEEPLEARNING #BIGDATAA