]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 86670 via svnmerge from
authorÉric Araujo <merwok@netwok.org>
Mon, 22 Nov 2010 03:18:24 +0000 (03:18 +0000)
committerÉric Araujo <merwok@netwok.org>
Mon, 22 Nov 2010 03:18:24 +0000 (03:18 +0000)
svn+ssh://pythondev@svn.python.org/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.
........

Doc/includes/mp_newtype.py
Doc/includes/sqlite3/adapter_point_1.py
Doc/includes/sqlite3/adapter_point_2.py
Doc/includes/sqlite3/converter_point.py
Doc/library/ctypes.rst
Doc/library/functions.rst
Doc/library/itertools.rst
Doc/library/multiprocessing.rst
Doc/library/sqlite3.rst
Doc/reference/compound_stmts.rst
Doc/reference/datamodel.rst

index d1a55a661c44821d47eb4f9aca2368fca0e8703b..729174363ed55a959a7ca3b9e58147a89f8df328 100644 (file)
@@ -12,7 +12,7 @@ import operator
 
 ##
 
-class Foo(object):
+class Foo:
     def f(self):
         print('you called Foo.f()')
     def g(self):
index 1343acde3cd19ed5db77903a917f9337936e187b..6b1af8415648a47ccaec42fa872bb3e479fd6f7d 100644 (file)
@@ -1,6 +1,6 @@
 import sqlite3
 
-class Point(object):
+class Point:
     def __init__(self, x, y):
         self.x, self.y = x, y
 
index 1e1719a3cc0216cd94651deb5551d18819ec30a2..d670700f0491b176b76de9d34dedb3e879db3781 100644 (file)
@@ -1,6 +1,6 @@
 import sqlite3
 
-class Point(object):
+class Point:
     def __init__(self, x, y):
         self.x, self.y = x, y
 
index d0707abd2e2cca4fbf3f4f3fe75cafae222fff00..a8861bcf2e8f4e19ee7c8ee99abe16f3b78a053d 100644 (file)
@@ -1,6 +1,6 @@
 import sqlite3
 
-class Point(object):
+class Point:
     def __init__(self, x, y):
         self.x, self.y = x, y
 
index 652a2f4d32431bdc4a2a53115df06e48fb851c7f..c822e7d0f9da44dc2dd00145b93a4e832cf1e4c8 100644 (file)
@@ -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
    ...
index 764fd8fb86ddbf58f589a612edea25306af3cd40..af005b3806f23e1a7aa06a2ebcbf91ab60f3f72a 100644 (file)
@@ -256,7 +256,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"]
       ...
@@ -864,7 +864,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
 
@@ -883,7 +883,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
 
@@ -900,7 +900,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
 
@@ -1200,7 +1200,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))
index 9b2aa40cfdf1d0de35416a3686d08d00d83b6850..b4854c675f518e4ec788e1218fbd87454f632d7d 100644 (file)
@@ -323,7 +323,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):
index a3fd9700c8f396a9142b06d9f3eeffe923df5a0e..9fa2d81cf774d533f47e584758378e39cc01e54a 100644 (file)
@@ -1318,7 +1318,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):
index ae15786faf916601e9643edbb9d710662c07a6df..b76f6ebd2d68fb25acdb57e5a186e5ef345d5987 100644 (file)
@@ -682,7 +682,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
 
index 5582cf65317b3de6fa64df77b8e724b52ab1075d..f5d919a7cf4c673659adfe88b1543d1b678a9805 100644 (file)
@@ -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.
index 9643f2b79e385ce0b8f329d23ae87d37c16c5faf..b33c1a1ff733c3bbdf666bc5cc70b9acc9dc7251 100644 (file)
@@ -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()