2.2 features

Tim Hochberg tim.hochberg at ieee.org
Thu Aug 2 21:46:46 CEST 2001

One sort of not particularly well though idea that popped into my head while
reading this is: why not attach the instance and subclass tests to Class
objects. Since presumably all classes and types could (will?) inherit from a
common base class/type in 2.2, this seems feasible at least. The names would
have to be changed to make this work; something like

isinstance(anInstance, aClass) => aClass.classof(anInstance)
isubclass(aSubclass, aBaseclass) => aBaseclass.superclassof(aSubclass)

I'm not sure what that's worth, but I figured I'd toss it to out into the


"Guido van Rossum" <guido at zope.com> wrote in message
news:mailman.996777043.30213.python-list at python.org...
> > >   if x in list: ...
> > >
> > > looks a lot more confusing.  I may withdraw this idea.
> >
> > I'd think again.  The problem with isinstance and issubclass is that I
> > can never remember the order of the arguments.  Something
> > non-symmetric like "x in type" is much clearer to me, to read and to
> > write.
> Yes, it's clearer, but it leads to hypergeneralization (dare I ever
> use that word again? :-).
> To remember isinstance() and isclass(), try to make a sentence out of
> it, like isinstance(x, y) <==> x is instance [of] y.
> --Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-list mailing list