diff options
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/compound_stmts.rst | 11 | ||||
-rw-r--r-- | Doc/reference/datamodel.rst | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 5582cf6..f5d919a 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -560,7 +560,16 @@ A class definition defines a class object (see section :ref:`types`): A class definition is an executable statement. The inheritance list usually gives a list of base classes (see :ref:`metaclasses` for more advanced uses), so each item in the list should evaluate to a class object which allows -subclassing. +subclassing. Classes without an inheritance list inherit, by default, from the +base class :class:`object`; hence, :: + + class Foo: + pass + +is equivalent to :: + + class Foo(object): + pass The class's suite is then executed in a new execution frame (see :ref:`naming`), using a newly created local namespace and the original global namespace. diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 9643f2b..b33c1a1 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1988,7 +1988,7 @@ to work correctly if defined on an object's type, not in the object's instance dictionary. That behaviour is the reason why the following code raises an exception:: - >>> class C(object): + >>> class C: ... pass ... >>> c = C() |