The value of Integer in Python

So...it's 10:00 in the morning and I thought that I would blog about the topic I saw in an article some days ago, it's about the integers in Python, was very new to me. I have my English practical today, and just like all other practicals I don't posses even a scintilla of preparation, but that's no conundrum. Saw a coding problem and while thinking about the solution to sort the balls in the containers I decided to blog which was in abstinence from quite a time. >>>print("Now I will be doing more of Python")
Basically, Python doesn't require us to specify the data types of the variables and it itself makes out what type of data is it, and so a question is very obvious that are there data types like long int, long long int, or unsigned int in Python too, just like C or C++. But the interesting part is that in Python 3 there is just one type of Int, and the juicy part is that we can store values of integers without any limits, which can go upto the available bits of memory. Like if you had to store a value like 10 to the power 20 then in C or C++ you would have to use the data type long long int, and same is the case with Java too. 
Another thing worth noting is that in Python 2 there are two types of Int, one is just Int and the other one being long int, where Int was just like the Int of C or C++, and the long int was same as the Int of Python 3. This is a typical Pythonic feature which doesn't bother the programmers to worry about the size of the values or to think about the usage of the data types but to just focus on the logic and the more interesting part of the code. Although I doubt that this would be a vulnerability if taking input from the users as there won't be any limit to the input and if the user is a malicious one, then they can make use of this to bring down the software. Well, we can't castigate Python for this, what happens in Python stays in Python.

Comments

Popular Posts