[Python-Dev] Int FutureWarnings and other 2.4 TODOs

Phillip J. Eby pje at telecommunity.com
Wed Dec 3 11:38:51 EST 2003


At 12:15 PM 12/3/03 -0500, Jeremy Fincher wrote:
>On Wednesday 03 December 2003 11:10 am, 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.

Not so.  Both '1' and '32' can be represented by int, so only the operation 
*result* needs to be a long.

Further, if the idea here is that 'int' will be a subclass of 'long', then 
it's perfectly valid to return an int from any operation declared as 
returning a long.  Further, since it's acceptable to *pass* an int for any 
argument declared 'long', it should suffice to use 'long' for all integer 
inputs and outputs of methods on 'long'.

Anyway, if the idea is that 'long' will be the base class, IMO the name 
'long' is confusing.  It should probably be called 'integer', with the 
subclass being either 'int' or 'short'.




More information about the Python-Dev mailing list