Discovering instance in Maya using Python

Used to find out if one something is an instance of another, lets look at an example:

class Animal(object):

  name=None

  def speak(self):
    print'My name is ', self.name

  def walk(self):
    print "I don’t know how to walk"

  def breath(self):
    print "I don’t know how to breath"

class Dog(Animal):

  def speak(self):
    print'Woof!!'

fido = Dog()

print isinstance(fido, Animal)
Output: True

This outputs True because ‘fido’ is an instance of the ‘Dog()’ class, which inherits from the ‘Animal()’ class (class Dog(Animal))