[Python-Dev] Unifying Long Integers and Integers: baseint (original) (raw)

Dmitry Vasiliev lists at hlabs.spb.ru
Mon Aug 9 17:38:18 CEST 2004


Michael Hudson wrote:

Dmitry Vasiliev <lists at hlabs.spb.ru> writes:

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 Not that I'm aware of. Personally, I think it's slightly more likely that we'll have:

int is long True but this is a long way off, and could cause upset with people who need to do bit bashing or interface with C.

Quote from PEP-237:

""" A new type, integer, may be introduced that is an abstract base type of which both the int and long implementation types are subclassed. This is useful so that programs can check integer-ness with a single test:

  if isinstance(i, integer): ...

"""

So maybe correct question then: is there a plan for implementing the integer type in Python 2.4?

Of course,

baseint = (int, long) makes what you type accurate today :-)

-- Dmitry Vasiliev (dima at hlabs.spb.ru) http://hlabs.spb.ru



More information about the Python-Dev mailing list