[Python-Dev] Int FutureWarnings and other 2.4 TODOs (original) (raw)

Nick Coghlan ncoghlan at iinet.net.au
Thu Dec 4 09:50:40 EST 2003


[Guido]

I guess that means I have to work harder and make the single int type support both representations. I'm sure it can be done.

Guido van Rossum wrote:

So the question is, does long have operations that int doesn't have? And if so, why can't those operations be added to int? And if there's a reason, is it good enough?

Taking into account their difference in representation, a long can support 1<<32, but an int can't. We're talking about a hypothetical int here where that operation returns 4294967296L. (Not so hypothetical, it's implemented in Python 2.4 in CVS.)

The 'performance hack' point of view I was trying to suggest was along the lines of:

"Python integers are capable of storing values of arbitrary magnitude, subject only to the memory capacity of the machine. As a matter of performance, Python will use native C integers (and native arithmetic) when the stored value is small enough to fit."

That is, I was agreeing with Guido's first point above.



More information about the Python-Dev mailing list