[Python-Dev] Unifying Long Integers and Integers: baseint

Michael Chermside mcherm at mcherm.com
Wed Aug 11 23:02:26 CEST 2004


> > Is there a plan for implementing a base class for int and long (like
> > basestring for str and unicode):
> >
> >  >>> issubclass(int, baseint) and issubclass(long, baseint)
> > True
> >
> > ?

> I think this would be a good idea; maybe the name should be
> baseinteger?

I would like to urge caution before making this change. Despite
what the PEP may say, I actually think that creating a 'baseint'
type is the WRONG design choice for the long term. I envision
an eventual Python which has just one type, called 'int'. The
fact that an efficient implementation is used when the ints
are small and an arbitrary-precision version when they get too
big would be hidden from the user by automatic promotion of
overflow. (By "hidden" I mean the user doesn't need to care, not
that they can't find out if they want to.) We are almost there
already, but if people start coding to 'baseinteger' it takes
us down a different path entirely. 'basestring' is a completely
different issue -- there will always be a need for both unicode
and 8-bit-strings as separate types.

-- Michael Chermside



More information about the Python-Dev mailing list