class instance checking -- newbie

Will Ware wware at world.std.com
Thu May 11 15:19:52 EDT 2000


Tim Northover (tim at pnorthover.freeserve.co.uk) wrote:
> I think I need to determine whether an object belongs to a particular
> class (specifically whether it is a MatchObject)...

>>> class Foo:
...   pass
... 
>>> a = Foo()
>>> a
<__main__.Foo instance at e3a20>
>>> isinstance(a, Foo)
1
>>> isinstance(11, Foo)
0

-- 
 - - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware	email:    wware @ world.std.com



More information about the Python-list mailing list