New Objects by Instantiating
Subtyping is only half the story.
| The call operator
(()) creates a new object by instantiating an
existing object. The existing object must be a
type. Depending on the type, the call operator might accept
arguments. |
| Python
syntax creates new objects for some built-in types. (The square
brackets create an instance of <type 'list'>,
for example). |
After the above exercise, our slate looks quite full.
Note that by just subtyping <type 'object'>, the type
C automatically is an instance of <type 'type'>. This
can be verified by checking C.__class__. Why this
happens is explained in the next section.