Aryan Pandey Aryan Pandey - 9 months ago 30
Python Question

How Python have so long integer range?

I have also seen other programming language by Python have a very huge integer range , even Java don't have , how ? How it's made possible?

Answer Source

Most programming languages offer integers based on the underlying CPU's machine word length, using single CPU instructions for e.g. add, in the interest of speed. It's always possible to provide a longer integer size by using multiple words and the carry/overflow flags in the hardware, but it's slower to do so and uses more memory.

This is very similar to how you do math on paper when you're given operands which are too big for you to multiply in your head.

Python prioritizes programmer convenience over raw speed, so it simply makes its integers as big as they need to be, on-demand.