how to find out if an object is a class?

Terry Reedy tjreedy at udel.edu
Fri Aug 8 00:04:48 EDT 2008



Carl Banks wrote:
> On Aug 7, 8:56 pm, Terry Reedy <tjre... at udel.edu> wrote:

>> That is only true and only works for 2.x old-style classes and not for
>> 2.x new-style classes and all 3.0 classes, for which isinstance(Q,type)
>> is True.
> 
> isinstance(Q,type) is also true for built in types and C extension
> types

That is rather the point of new and improved classes -- that the 
implementation language of a class be pretty much irrelevant from the 
user api viewpoint ;-)




More information about the Python-list mailing list