class instance checking -- newbie

Fredrik Lundh effbot at telia.com
Thu May 11 15:14:49 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) and I couldn't find
> anything very useful in the documentation. Could someone possibly suggest
> an answer or point me at the correct part of the docs?

>>> isinstance
<built-in function isinstance>
>>> print isinstance.__doc__
isinstance(object, class-or-type) -> Boolean

Return whether an object is an instance of a class or of a subclass thereof.
With a type as second argument, return whether that is the object's type.

</F>




More information about the Python-list mailing list