summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2010-11-22 03:09:19 (GMT)
committerÉric Araujo <merwok@netwok.org>2010-11-22 03:09:19 (GMT)
commit28053fb174cd548629b8c94cba02ce837aeb9e5b (patch)
treeb5450a4b4e121f3a9b649aa4f6e00a4dcbde88bf /Doc/reference
parentd4bbab278fc5021f5adbf4ae336e2754ca2037b3 (diff)
downloadcpython-28053fb174cd548629b8c94cba02ce837aeb9e5b.zip
cpython-28053fb174cd548629b8c94cba02ce837aeb9e5b.tar.gz
cpython-28053fb174cd548629b8c94cba02ce837aeb9e5b.tar.bz2
Remove unnecessary `object` base class in docs (#10366).
Also add a note about inheritance from `object` being default.
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/compound_stmts.rst11
-rw-r--r--Doc/reference/datamodel.rst2
2 files changed, 11 insertions, 2 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 95d5705..1622133 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -561,7 +561,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 783259c..adedefc 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1987,7 +1987,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()