Quote from PEP-237 (http://www.python.org/peps/pep-0237.html): """ 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): ... """ The patch implement the superclass for int and long with name 'baseinteger'.
Logged In: YES user_id=6380 +1 One suggestion: I'd add some words to the docs to recommend *not* to use this for one's own integer-ish class. Instead, subclassing from int or long is recommended, to avoid confusion (since many built-in operations and extensions accept only "genuine" integers, i.e. int or long or subclasses thereof).
Logged In: YES user_id=6380 I take it back. Few people on python-dev cared about this, and there's at least one potential abuse (subclassing from it won't do the right thing). It's also something that will go away again in 3.0 (where there will be only one integral type). Let's just by convention write isinstance(x, (int,long)) when we really need it. You may ask what about basestring? Its use case is similarly weak, and I expect it to disappear in 3.0. Let's not repeat the mistake. So I'm rejecting this now. Sorry!