Summary

To summarize all that has been said:
  • There are two kinds of objects in Python:

    1. Type objects - can create instances, can be subclassed.

    2. Non-type objects - cannot create instances, cannot be subclassed.

  • <type 'type'> and <type 'object'> are two primitive objects of the system.

  • objectname.__class__ exists for every object and points the type of the object.

  • objectname.__bases__ exists for every type object and points the superclasses of the object. It is empty only for <type 'object'>.

  • To create a new object using subclassing, we use the class statement and specify the bases (and, optionally, the type) of the new object. This always creates a type object.

  • To create a new object using instantiation, we use the call operator (()) on the type object we want to use. This may create a type or a non-type object, depending on which type object was used.

  • Some non-type objects can be created using special Python syntax. For example, [1, 2, 3] creates an instance of <type 'list'>.

  • Internally, Python always uses a type object to create a new object. The new object created is an instance of the type object used. Python determines the type object from a class statement by looking at the bases specified, and finding their types.

  • issubclass(A,B) (testing for superclass-subclass relationship) returns True iff:

    1. B is in A.__bases__, or

    2. issubclass(Z,B) is true for any Z in A.__bases__.

  • isinstance(A,B) (testing for type-instance relationship) returns True iff:

    1. B is A.__class__, or

    2. issubclass(A.__class__,B) is true.

  • Squasher is really a python. (Okay, that wasn't mentioned before, but now you know.)