[Python-checkins] bpo-40304: Correct type(name, bases, dict) doc (GH-19553)

miss-islington webhook-mailer at python.org
Fri Jan 22 01:10:09 EST 2021


https://github.com/python/cpython/commit/98e1f5c778b9719f6338a3247da95402192bad18
commit: 98e1f5c778b9719f6338a3247da95402192bad18
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-01-21T22:09:50-08:00
summary:

bpo-40304: Correct type(name, bases, dict) doc (GH-19553)


Co-authored-by: Éric Araujo <merwok at netwok.org>
Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>
Co-authored-by: Tal Einat <532281+taleinat at users.noreply.github.com>
(cherry picked from commit 644d52818a6391535e5838fd57d58ffcb1163056)

Co-authored-by: Борис Верховский <boris.verk at gmail.com>

files:
A Misc/NEWS.d/next/Documentation/2021-01-20-23-03-49.bpo-40304.-LK7Ps.rst
M Doc/library/functions.rst

diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 9c12b6c48d8ff..9d13967c04fff 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1687,18 +1687,19 @@ are always available.  They are listed here in alphabetical order.
 
 
    With three arguments, return a new type object.  This is essentially a
-   dynamic form of the :keyword:`class` statement. The *name* string is the
-   class name and becomes the :attr:`~definition.__name__` attribute; the *bases*
-   tuple itemizes the base classes and becomes the :attr:`~class.__bases__`
-   attribute; and the *dict* dictionary is the namespace containing definitions
-   for class body and is copied to a standard dictionary to become the
-   :attr:`~object.__dict__` attribute.  For example, the following two
-   statements create identical :class:`type` objects:
+   dynamic form of the :keyword:`class` statement. The *name* string is
+   the class name and becomes the :attr:`~definition.__name__` attribute.
+   The *bases* tuple contains the base classes and becomes the
+   :attr:`~class.__bases__` attribute; if empty, :class:`object`, the
+   ultimate base of all classes, is added.  The *dict* dictionary contains
+   attribute and method definitions for the class body; it may be copied
+   or wrapped before becoming the :attr:`~object.__dict__` attribute.
+   The following two statements create identical :class:`type` objects:
 
       >>> class X:
       ...     a = 1
       ...
-      >>> X = type('X', (object,), dict(a=1))
+      >>> X = type('X', (), dict(a=1))
 
    See also :ref:`bltin-type-objects`.
 
diff --git a/Misc/NEWS.d/next/Documentation/2021-01-20-23-03-49.bpo-40304.-LK7Ps.rst b/Misc/NEWS.d/next/Documentation/2021-01-20-23-03-49.bpo-40304.-LK7Ps.rst
new file mode 100644
index 0000000000000..3f2f14c2d7b89
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2021-01-20-23-03-49.bpo-40304.-LK7Ps.rst
@@ -0,0 +1,2 @@
+Fix doc for type(name, bases, dict).  Patch by Boris Verkhovskiy and
+Éric Araujo.



More information about the Python-checkins mailing list