]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#26829: Clarify that namespace is copied to a new __dict__ in instance creation.
authorR David Murray <rdmurray@bitdance.com>
Fri, 3 Jun 2016 00:05:43 +0000 (20:05 -0400)
committerR David Murray <rdmurray@bitdance.com>
Fri, 3 Jun 2016 00:05:43 +0000 (20:05 -0400)
Patch by Emily Morehouse.

Doc/library/functions.rst
Doc/reference/datamodel.rst
Misc/ACKS

index 89b2ac634ca3b6b18fdb588ee523a5f560ec9355..c3563f369093a1305f79d35dd2cf4b27957925d3 100644 (file)
@@ -1449,8 +1449,9 @@ are always available.  They are listed here in alphabetical order.
    class name and becomes the :attr:`~class.__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 becomes the :attr:`~object.__dict__` attribute.  For
-   example, the following two statements create identical :class:`type` objects:
+   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:
 
       >>> class X:
       ...     a = 1
index 2b59ce13bb248c2d956a047a0f172636ceb64826..3ddbd622d8770094743adb0c3836e197e161a8d2 100644 (file)
@@ -1734,6 +1734,11 @@ After the class object is created, it is passed to the class decorators
 included in the class definition (if any) and the resulting object is bound
 in the local namespace as the defined class.
 
+When a new class is created by ``type.__new__``, the object provided as the
+namespace parameter is copied to a standard Python dictionary and the original
+object is discarded. The new copy becomes the :attr:`~object.__dict__` attribute
+of the class object.
+
 .. seealso::
 
    :pep:`3135` - New super
index bfdc44708c15ffb435a60aea385838799ab14686..0da5cf8d8f98dac195a9a53d0c7f786490166f7e 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -999,6 +999,7 @@ Peter Moody
 Paul Moore
 Ross Moore
 Ben Morgan
+Emily Morehouse
 Derek Morr
 James A Morrison
 Martin Morrison