[Zope-dev] ExtensionClass is not of type Class?!

Brian Lloyd brian.lloyd@zope.com
Mon, 20 Aug 2001 09:39:31 -0400


> TypeError: isinstance() arg 2 must be a class or type
> 
> Given the above, I put a "print Squishfile" in the line above the 
> assert, it
> gave:
> 
> <extension class Products.Squishdot.Squishfile.Squishfile at 010ABC48>
> 
> So are extension classes not usuable with isinstance?

The Python 1.5.2 isinstance does not recognize Extension Classes (it
works as expected as of Python 2.x).


> If not, what should I be doing to check I'm creating an object of 
> the right
> type?

A workable hack would be:

assert ob.__class__ is theClass


Brian Lloyd        brian@zope.com          
Zope Corporation   www.zope.com