[Tutor] FW: isinstance -> instance

Kent Johnson kent37 at tds.net
Mon Feb 26 23:29:55 CET 2007

Jerry Hill wrote:
> I believe you can check for an instance of a new-style class
> with:
> isinstance(a, object)

I'm not sure if that will ever fail. Given values from my previous post, 
I get:
In [16]: isinstance(a, object)
Out[16]: True
In [17]: isinstance(A, object)
Out[17]: True
In [18]: isinstance(b, object)
Out[18]: True
In [19]: isinstance(types, object)
Out[19]: True
In [20]: def f(): pass
In [21]: isinstance(f, object)
Out[21]: True


More information about the Tutor mailing list