[Python-Dev] Re: Int FutureWarnings and other 2.4 TODOs

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Dec 4 19:47:02 EST 2003

Andrew Koenig <ark-mlist at att.net>:

> > (It has been pointed out that subclassing int isn't very useful, so
> > maybe this is a moot point.  Does anybody have a real use case?)
> isinstance(x, int)
> That doesn't require an inheritance relationship between the integral types,
> but it does require that long inherit from int.

Having int be an abstract class doesn't prevent it from being
subclassed - it just means the subclass needs to to more work
in order to behave like other concrete int subclasses.

Along with short and long, there could be a UserInt subclass
which delegates all the operations to an implementation object,
for people who really want an int subclass for some reason.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list