The built-in objects are, well, built into Python. They're there when we start Python, usually there when we finish. So how can we create new objects?
New objects cannot pop out of thin air. They have to be built using existing objects. Specifically, we can only create objects that are at the tail-end of a relationship (i.e. tail-end of an arrow).
Example 2.4. Creating new objects by subtyping
class C(object):pass
class D(object): pass class E(C, D):
pass class MyList(list):
pass
After the above example, C.__bases__ contains
<type 'object'>, and MyList.__bases__ contains
<type 'list'>.
The term class is traditionally used to
imply an object created by the class
statement. However, classes are now synonymous
with types. Built-in types are usually not referred to as
classes. This book prefers using the term type
for both built-in and user created types.
pass
class D(object):
pass
class E(C, D):
pass
class MyList(list):
pass