[Python-Dev] Int FutureWarnings and other 2.4 TODOs

Guido van Rossum guido at python.org
Mon Dec 8 00:08:04 EST 2003


I've figured the whole int/short/long thing out now.  Jack may be
happy to know that it happened on a long bike ride. :-)

There will be two classes, and they can both be user-visible, but
users will generally deal in terms of the class called 'int', which is
the base class.  It is called 'int', but its implementation is what we
currently call 'long'.  The subclass will be called 'short',
implemented as what we currently call 'int'.  The 'short' class will
not be subclassable.  The 'int' class can tell the difference between
the two representations by looking at the class pointer -- if it's
'short' then the short representation applies.  Both will
automatically return an object of the other class if the size of the
return value requires/allows it.  The new 'short', the current 'int',
already does this -- the new 'int', currently 'long' will have to be
adapted.  But (unlike 'short') it doesn't have to be perfect...  (If
'int' is subclassed, it may return an instance of the subclass always,
to make subclassing int more useful -- "contagiousness" helps in this
case I think.)

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list