
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?
If every operation that might conceivably yield an int quietly yields a long when the result doesn't fit in an int, then it is possible for int and long to have the same operations.
In which case, why do they have different types? Just as an implementation detail?
Right. The implementation uses the type as the vtable of a C++ class, and the functions in the vtable "know" the representation, which is very different for short and long ints. This is all nice and efficient, except that the identity of the vtable is returned as the type of the object, so two different vtables means two different types. The alternative implementation technique is to have a single type/vtable, embed a flag in each instance that tells the implementation which representation is used, and have an "if" at the top of each implementation function switching between the two. The downslide should be obvious: not only an extra test+branch for each operation, but also extra space in the object (the short representation has no spare bits). --Guido van Rossum (home page: http://www.python.org/~guido/)