Python does not ship with only two objects. Oh no, the two primitives
come with a whole gang of buddies.
A few built-in types are shown above, and examined below.
The built-in
| |
Its type is
| |
It has one
base (a.k.a. superclass), | |
Ditto for | |
This is how you
create an instance of | |
The type of a list
is |
When we create a tuple or a dictionary, they are instances of the respective types.
So how can we create an instance of
mylist? We cannot. This is because
mylist is a not a type.

<type 'list'>
>>> list.__class__
<type 'type'>
>>> list.__bases__
(<type 'object'>,)
>>> tuple.__class__, tuple.__bases__
(<type 'type'>, (<type 'object'>,))
>>> dict.__class__, dict.__bases__
(<type 'type'>, (<type 'object'>,))
>>>
>>> mylist = [1,2,3]
>>> mylist.__class__
<type 'list'>