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

Skip to content

Commit da825ab

Browse files
committed
Merged revisions 86670 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r86670 | eric.araujo | 2010-11-22 04:09:19 +0100 (lun., 22 nov. 2010) | 5 lines Remove unnecessary `object` base class in docs (#10366). Also add a note about inheritance from `object` being default. ........
1 parent f213d23 commit da825ab

11 files changed

Lines changed: 24 additions & 15 deletions

File tree

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/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
@@ -256,7 +256,7 @@ are always available. They are listed here in alphabetical order.
256256
['Struct', '__builtins__', '__doc__', '__file__', '__name__',
257257
'__package__', '_clearcache', 'calcsize', 'error', 'pack', 'pack_into',
258258
'unpack', 'unpack_from']
259-
>>> class Foo(object):
259+
>>> class Foo:
260260
... def __dir__(self):
261261
... return ["kan", "ga", "roo"]
262262
...
@@ -864,7 +864,7 @@ are always available. They are listed here in alphabetical order.
864864
function for setting, and *fdel* a function for del'ing, an attribute. Typical
865865
use is to define a managed attribute ``x``::
866866

867-
class C(object):
867+
class C:
868868
def __init__(self):
869869
self._x = None
870870

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

886-
class Parrot(object):
886+
class Parrot:
887887
def __init__(self):
888888
self._voltage = 100000
889889

@@ -900,7 +900,7 @@ are always available. They are listed here in alphabetical order.
900900
corresponding accessor function set to the decorated function. This is
901901
best explained with an example::
902902

903-
class C(object):
903+
class C:
904904
def __init__(self):
905905
self._x = None
906906

@@ -1200,7 +1200,7 @@ are always available. They are listed here in alphabetical order.
12001200
attribute. For example, the following two statements create identical
12011201
:class:`type` objects:
12021202

1203-
>>> class X(object):
1203+
>>> class X:
12041204
... a = 1
12051205
...
12061206
>>> X = type('X', (object,), dict(a=1))

Doc/library/itertools.rst

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

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

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

Doc/library/multiprocessing.rst

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

13191319
from multiprocessing.managers import BaseManager
13201320

1321-
class MathsClass(object):
1321+
class MathsClass:
13221322
def add(self, x, y):
13231323
return x + y
13241324
def mul(self, x, y):

Doc/library/sqlite3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ Letting your object adapt itself
682682
This is a good approach if you write the class yourself. Let's suppose you have
683683
a class like this::
684684

685-
class Point(object):
685+
class Point:
686686
def __init__(self, x, y):
687687
self.x, self.y = x, y
688688

Doc/reference/compound_stmts.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,16 @@ A class definition defines a class object (see section :ref:`types`):
560560
A class definition is an executable statement. The inheritance list usually
561561
gives a list of base classes (see :ref:`metaclasses` for more advanced uses), so
562562
each item in the list should evaluate to a class object which allows
563-
subclassing.
563+
subclassing. Classes without an inheritance list inherit, by default, from the
564+
base class :class:`object`; hence, ::
565+
566+
class Foo:
567+
pass
568+
569+
is equivalent to ::
570+
571+
class Foo(object):
572+
pass
564573

565574
The class's suite is then executed in a new execution frame (see :ref:`naming`),
566575
using a newly created local namespace and the original global namespace.

0 commit comments

Comments
 (0)