Does anybody know how Python manage internally int and long types?
How should I understand the code below?
>>> print type(65535) <type 'int'> >>> print type(65536*65536) <type 'long'>
>>> print type(0x7fffffff) <type 'int'> >>> print type(0x80000000) <type 'long'>
long were "unified" a few versions back. Before that it was possible to overflow an int through math ops.
3.x has further advanced this by eliminating long altogether and only having int.
sys.maxintcontains the maximum value a Python int can hold.
sys.maxsizecontains the maximum size in bytes a Python int can be.