summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2010-11-22 03:09:19 +0000
committerÉric Araujo <merwok@netwok.org>2010-11-22 03:09:19 +0000
commit28053fb174cd548629b8c94cba02ce837aeb9e5b (patch)
treeb5450a4b4e121f3a9b649aa4f6e00a4dcbde88bf
parentd4bbab278fc5021f5adbf4ae336e2754ca2037b3 (diff)
downloadcpython-git-28053fb174cd548629b8c94cba02ce837aeb9e5b.tar.gz
Remove unnecessary `object` base class in docs (#10366).
Also add a note about inheritance from `object` being default.
-rw-r--r--Doc/includes/mp_newtype.py2
-rw-r--r--Doc/includes/sqlite3/adapter_point_1.py2
-rw-r--r--Doc/includes/sqlite3/adapter_point_2.py2
-rw-r--r--Doc/includes/sqlite3/converter_point.py2
-rw-r--r--Doc/library/argparse.rst2
-rw-r--r--Doc/library/ctypes.rst2
-rw-r--r--Doc/library/functions.rst10
-rw-r--r--Doc/library/inspect.rst2
-rw-r--r--Doc/library/itertools.rst2
-rw-r--r--Doc/library/multiprocessing.rst2
-rw-r--r--Doc/library/sqlite3.rst2
-rw-r--r--Doc/reference/compound_stmts.rst11
-rw-r--r--Doc/reference/datamodel.rst2
13 files changed, 26 insertions, 17 deletions
diff --git a/Doc/includes/mp_newtype.py b/Doc/includes/mp_newtype.py
index d1a55a661c..729174363e 100644
--- a/Doc/includes/mp_newtype.py
+++ b/Doc/includes/mp_newtype.py
@@ -12,7 +12,7 @@ import operator
##
-class Foo(object):
+class Foo:
def f(self):
print('you called Foo.f()')
def g(self):
diff --git a/Doc/includes/sqlite3/adapter_point_1.py b/Doc/includes/sqlite3/adapter_point_1.py
index 1343acde3c..6b1af84156 100644
--- a/Doc/includes/sqlite3/adapter_point_1.py
+++ b/Doc/includes/sqlite3/adapter_point_1.py
@@ -1,6 +1,6 @@
import sqlite3
-class Point(object):
+class Point:
def __init__(self, x, y):
self.x, self.y = x, y
diff --git a/Doc/includes/sqlite3/adapter_point_2.py b/Doc/includes/sqlite3/adapter_point_2.py
index 1e1719a3cc..d670700f04 100644
--- a/Doc/includes/sqlite3/adapter_point_2.py
+++ b/Doc/includes/sqlite3/adapter_point_2.py
@@ -1,6 +1,6 @@
import sqlite3
-class Point(object):
+class Point:
def __init__(self, x, y):
self.x, self.y = x, y
diff --git a/Doc/includes/sqlite3/converter_point.py b/Doc/includes/sqlite3/converter_point.py
index d0707abd2e..a8861bcf2e 100644
--- a/Doc/includes/sqlite3/converter_point.py
+++ b/Doc/includes/sqlite3/converter_point.py
@@ -1,6 +1,6 @@
import sqlite3
-class Point(object):
+class Point:
def __init__(self, x, y):
self.x, self.y = x, y
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 349df002b5..63b25bb63e 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1312,7 +1312,7 @@ already existing object, rather than the newly-created :class:`Namespace` object
that is normally used. This can be achieved by specifying the ``namespace=``
keyword argument::
- >>> class C(object):
+ >>> class C:
... pass
...
>>> c = C()
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index a8977f8395..35874b69ff 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -369,7 +369,7 @@ your own classes be used as function arguments. :mod:`ctypes` looks for an
:attr:`_as_parameter_` attribute and uses this as the function argument. Of
course, it must be one of integer, string, or bytes::
- >>> class Bottles(object):
+ >>> class Bottles:
... def __init__(self, number):
... self._as_parameter_ = number
...
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 61bf3912b3..ec01d69702 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -259,7 +259,7 @@ are always available. They are listed here in alphabetical order.
['Struct', '__builtins__', '__doc__', '__file__', '__name__',
'__package__', '_clearcache', 'calcsize', 'error', 'pack', 'pack_into',
'unpack', 'unpack_from']
- >>> class Foo(object):
+ >>> class Foo:
... def __dir__(self):
... return ["kan", "ga", "roo"]
...
@@ -903,7 +903,7 @@ are always available. They are listed here in alphabetical order.
function for setting, and *fdel* a function for del'ing, an attribute. Typical
use is to define a managed attribute ``x``::
- class C(object):
+ class C:
def __init__(self):
self._x = None
@@ -922,7 +922,7 @@ are always available. They are listed here in alphabetical order.
property will copy *fget*'s docstring (if it exists). This makes it possible to
create read-only properties easily using :func:`property` as a :term:`decorator`::
- class Parrot(object):
+ class Parrot:
def __init__(self):
self._voltage = 100000
@@ -939,7 +939,7 @@ are always available. They are listed here in alphabetical order.
corresponding accessor function set to the decorated function. This is
best explained with an example::
- class C(object):
+ class C:
def __init__(self):
self._x = None
@@ -1243,7 +1243,7 @@ are always available. They are listed here in alphabetical order.
attribute. For example, the following two statements create identical
:class:`type` objects:
- >>> class X(object):
+ >>> class X:
... a = 1
...
>>> X = type('X', (object,), dict(a=1))
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index f81e1572ea..4845bcaa04 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -604,7 +604,7 @@ for arbitrary getset descriptors invoking these may trigger
code execution::
# example code for resolving the builtin descriptor types
- class _foo(object):
+ class _foo:
__slots__ = ['foo']
slot_descriptor = type(_foo.foo)
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index f66b0c9f0d..f612a1c4de 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -322,7 +322,7 @@ loops that truncate the stream.
:func:`groupby` is equivalent to::
- class groupby(object):
+ class groupby:
# [k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D A B
# [list(g) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
def __init__(self, iterable, key=None):
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
index d7a37c3f1a..a52824f24f 100644
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -1334,7 +1334,7 @@ callables with the manager class. For example::
from multiprocessing.managers import BaseManager
- class MathsClass(object):
+ class MathsClass:
def add(self, x, y):
return x + y
def mul(self, x, y):
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 9aa7b385a2..3cad148742 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -710,7 +710,7 @@ Letting your object adapt itself
This is a good approach if you write the class yourself. Let's suppose you have
a class like this::
- class Point(object):
+ class Point:
def __init__(self, x, y):
self.x, self.y = x, y
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 95d5705602..162213380c 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 783259c451..adedefc99c 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()