[Python-checkins] r86670 - in python/branches/py3k/Doc: includes/mp_newtype.py includes/sqlite3/adapter_point_1.py includes/sqlite3/adapter_point_2.py includes/sqlite3/converter_point.py library/argparse.rst library/ctypes.rst library/functions.rst library/inspect.rst library/itertools.rst library/multiprocessing.rst library/sqlite3.rst reference/compound_stmts.rst reference/datamodel.rst

eric.araujo python-checkins at python.org
Mon Nov 22 04:09:19 CET 2010


Author: eric.araujo
Date: Mon Nov 22 04:09:19 2010
New Revision: 86670

Log:

Remove unnecessary `object` base class in docs (#9095).

Also add a note about inheritance from `object` being default.


Modified:
   python/branches/py3k/Doc/includes/mp_newtype.py
   python/branches/py3k/Doc/includes/sqlite3/adapter_point_1.py
   python/branches/py3k/Doc/includes/sqlite3/adapter_point_2.py
   python/branches/py3k/Doc/includes/sqlite3/converter_point.py
   python/branches/py3k/Doc/library/argparse.rst
   python/branches/py3k/Doc/library/ctypes.rst
   python/branches/py3k/Doc/library/functions.rst
   python/branches/py3k/Doc/library/inspect.rst
   python/branches/py3k/Doc/library/itertools.rst
   python/branches/py3k/Doc/library/multiprocessing.rst
   python/branches/py3k/Doc/library/sqlite3.rst
   python/branches/py3k/Doc/reference/compound_stmts.rst
   python/branches/py3k/Doc/reference/datamodel.rst

Modified: python/branches/py3k/Doc/includes/mp_newtype.py
==============================================================================
--- python/branches/py3k/Doc/includes/mp_newtype.py	(original)
+++ python/branches/py3k/Doc/includes/mp_newtype.py	Mon Nov 22 04:09:19 2010
@@ -12,7 +12,7 @@
 
 ##
 
-class Foo(object):
+class Foo:
     def f(self):
         print('you called Foo.f()')
     def g(self):

Modified: python/branches/py3k/Doc/includes/sqlite3/adapter_point_1.py
==============================================================================
--- python/branches/py3k/Doc/includes/sqlite3/adapter_point_1.py	(original)
+++ python/branches/py3k/Doc/includes/sqlite3/adapter_point_1.py	Mon Nov 22 04:09:19 2010
@@ -1,6 +1,6 @@
 import sqlite3
 
-class Point(object):
+class Point:
     def __init__(self, x, y):
         self.x, self.y = x, y
 

Modified: python/branches/py3k/Doc/includes/sqlite3/adapter_point_2.py
==============================================================================
--- python/branches/py3k/Doc/includes/sqlite3/adapter_point_2.py	(original)
+++ python/branches/py3k/Doc/includes/sqlite3/adapter_point_2.py	Mon Nov 22 04:09:19 2010
@@ -1,6 +1,6 @@
 import sqlite3
 
-class Point(object):
+class Point:
     def __init__(self, x, y):
         self.x, self.y = x, y
 

Modified: python/branches/py3k/Doc/includes/sqlite3/converter_point.py
==============================================================================
--- python/branches/py3k/Doc/includes/sqlite3/converter_point.py	(original)
+++ python/branches/py3k/Doc/includes/sqlite3/converter_point.py	Mon Nov 22 04:09:19 2010
@@ -1,6 +1,6 @@
 import sqlite3
 
-class Point(object):
+class Point:
     def __init__(self, x, y):
         self.x, self.y = x, y
 

Modified: python/branches/py3k/Doc/library/argparse.rst
==============================================================================
--- python/branches/py3k/Doc/library/argparse.rst	(original)
+++ python/branches/py3k/Doc/library/argparse.rst	Mon Nov 22 04:09:19 2010
@@ -1312,7 +1312,7 @@
 that is normally used.  This can be achieved by specifying the ``namespace=``
 keyword argument::
 
-   >>> class C(object):
+   >>> class C:
    ...     pass
    ...
    >>> c = C()

Modified: python/branches/py3k/Doc/library/ctypes.rst
==============================================================================
--- python/branches/py3k/Doc/library/ctypes.rst	(original)
+++ python/branches/py3k/Doc/library/ctypes.rst	Mon Nov 22 04:09:19 2010
@@ -369,7 +369,7 @@
 :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
    ...

Modified: python/branches/py3k/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k/Doc/library/functions.rst	(original)
+++ python/branches/py3k/Doc/library/functions.rst	Mon Nov 22 04:09:19 2010
@@ -259,7 +259,7 @@
       ['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 @@
    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 @@
    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 @@
    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 @@
    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))

Modified: python/branches/py3k/Doc/library/inspect.rst
==============================================================================
--- python/branches/py3k/Doc/library/inspect.rst	(original)
+++ python/branches/py3k/Doc/library/inspect.rst	Mon Nov 22 04:09:19 2010
@@ -604,7 +604,7 @@
 code execution::
 
    # example code for resolving the builtin descriptor types
-   class _foo(object):
+   class _foo:
        __slots__ = ['foo']
 
    slot_descriptor = type(_foo.foo)

Modified: python/branches/py3k/Doc/library/itertools.rst
==============================================================================
--- python/branches/py3k/Doc/library/itertools.rst	(original)
+++ python/branches/py3k/Doc/library/itertools.rst	Mon Nov 22 04:09:19 2010
@@ -322,7 +322,7 @@
 
    :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):

Modified: python/branches/py3k/Doc/library/multiprocessing.rst
==============================================================================
--- python/branches/py3k/Doc/library/multiprocessing.rst	(original)
+++ python/branches/py3k/Doc/library/multiprocessing.rst	Mon Nov 22 04:09:19 2010
@@ -1334,7 +1334,7 @@
 
    from multiprocessing.managers import BaseManager
 
-   class MathsClass(object):
+   class MathsClass:
        def add(self, x, y):
            return x + y
        def mul(self, x, y):

Modified: python/branches/py3k/Doc/library/sqlite3.rst
==============================================================================
--- python/branches/py3k/Doc/library/sqlite3.rst	(original)
+++ python/branches/py3k/Doc/library/sqlite3.rst	Mon Nov 22 04:09:19 2010
@@ -710,7 +710,7 @@
 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
 

Modified: python/branches/py3k/Doc/reference/compound_stmts.rst
==============================================================================
--- python/branches/py3k/Doc/reference/compound_stmts.rst	(original)
+++ python/branches/py3k/Doc/reference/compound_stmts.rst	Mon Nov 22 04:09:19 2010
@@ -561,7 +561,16 @@
 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.

Modified: python/branches/py3k/Doc/reference/datamodel.rst
==============================================================================
--- python/branches/py3k/Doc/reference/datamodel.rst	(original)
+++ python/branches/py3k/Doc/reference/datamodel.rst	Mon Nov 22 04:09:19 2010
@@ -1987,7 +1987,7 @@
 dictionary.  That behaviour is the reason why the following code raises an
 exception::
 
-   >>> class C(object):
+   >>> class C:
    ...     pass
    ...
    >>> c = C()


More information about the Python-checkins mailing list