Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28053fb

Browse files
committed
Remove unnecessary object base class in docs (#10366).
Also add a note about inheritance from `object` being default.
1 parent d4bbab2 commit 28053fb

13 files changed

Lines changed: 26 additions & 17 deletions

Doc/includes/mp_newtype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
##
1414

15-
class Foo(object):
15+
class Foo:
1616
def f(self):
1717
print('you called Foo.f()')
1818
def g(self):

Doc/includes/sqlite3/adapter_point_1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sqlite3
22

3-
class Point(object):
3+
class Point:
44
def __init__(self, x, y):
55
self.x, self.y = x, y
66

Doc/includes/sqlite3/adapter_point_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sqlite3
22

3-
class Point(object):
3+
class Point:
44
def __init__(self, x, y):
55
self.x, self.y = x, y
66

Doc/includes/sqlite3/converter_point.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sqlite3
22

3-
class Point(object):
3+
class Point:
44
def __init__(self, x, y):
55
self.x, self.y = x, y
66

Doc/library/argparse.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ already existing object, rather than the newly-created :class:`Namespace` object
13121312
that is normally used. This can be achieved by specifying the ``namespace=``
13131313
keyword argument::
13141314

1315-
>>> class C(object):
1315+
>>> class C:
13161316
... pass
13171317
...
13181318
>>> c = C()

Doc/library/ctypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ your own classes be used as function arguments. :mod:`ctypes` looks for an
369369
:attr:`_as_parameter_` attribute and uses this as the function argument. Of
370370
course, it must be one of integer, string, or bytes::
371371

372-
>>> class Bottles(object):
372+
>>> class Bottles:
373373
... def __init__(self, number):
374374
... self._as_parameter_ = number
375375
...

Doc/library/functions.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ are always available. They are listed here in alphabetical order.
259259
['Struct', '__builtins__', '__doc__', '__file__', '__name__',
260260
'__package__', '_clearcache', 'calcsize', 'error', 'pack', 'pack_into',
261261
'unpack', 'unpack_from']
262-
>>> class Foo(object):
262+
>>> class Foo:
263263
... def __dir__(self):
264264
... return ["kan", "ga", "roo"]
265265
...
@@ -903,7 +903,7 @@ are always available. They are listed here in alphabetical order.
903903
function for setting, and *fdel* a function for del'ing, an attribute. Typical
904904
use is to define a managed attribute ``x``::
905905

906-
class C(object):
906+
class C:
907907
def __init__(self):
908908
self._x = None
909909

@@ -922,7 +922,7 @@ are always available. They are listed here in alphabetical order.
922922
property will copy *fget*'s docstring (if it exists). This makes it possible to
923923
create read-only properties easily using :func:`property` as a :term:`decorator`::
924924

925-
class Parrot(object):
925+
class Parrot:
926926
def __init__(self):
927927
self._voltage = 100000
928928

@@ -939,7 +939,7 @@ are always available. They are listed here in alphabetical order.
939939
corresponding accessor function set to the decorated function. This is
940940
best explained with an example::
941941

942-
class C(object):
942+
class C:
943943
def __init__(self):
944944
self._x = None
945945

@@ -1243,7 +1243,7 @@ are always available. They are listed here in alphabetical order.
12431243
attribute. For example, the following two statements create identical
12441244
:class:`type` objects:
12451245

1246-
>>> class X(object):
1246+
>>> class X:
12471247
... a = 1
12481248
...
12491249
>>> X = type('X', (object,), dict(a=1))

Doc/library/inspect.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ for arbitrary getset descriptors invoking these may trigger
604604
code execution::
605605

606606
# example code for resolving the builtin descriptor types
607-
class _foo(object):
607+
class _foo:
608608
__slots__ = ['foo']
609609

610610
slot_descriptor = type(_foo.foo)

Doc/library/itertools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ loops that truncate the stream.
322322

323323
:func:`groupby` is equivalent to::
324324

325-
class groupby(object):
325+
class groupby:
326326
# [k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D A B
327327
# [list(g) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
328328
def __init__(self, iterable, key=None):

Doc/library/multiprocessing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ callables with the manager class. For example::
13341334

13351335
from multiprocessing.managers import BaseManager
13361336

1337-
class MathsClass(object):
1337+
class MathsClass:
13381338
def add(self, x, y):
13391339
return x + y
13401340
def mul(self, x, y):

0 commit comments

Comments
 (0)