summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2016-09-08 22:11:11 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2016-09-08 22:11:11 (GMT)
commit4f29e75289592991efcc65a96a2a4a995417b76e (patch)
treeb6d0019f076909e11633cadc468a7822124965a3 /Doc
parent7f730cf01d161f2d1793372a0852788ad5f4acb1 (diff)
downloadcpython-4f29e75289592991efcc65a96a2a4a995417b76e.zip
cpython-4f29e75289592991efcc65a96a2a4a995417b76e.tar.gz
cpython-4f29e75289592991efcc65a96a2a4a995417b76e.tar.bz2
Issue #24254: Drop cls.__definition_order__.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/inspect.rst367
-rw-r--r--Doc/library/types.rst10
-rw-r--r--Doc/reference/compound_stmts.rst12
-rw-r--r--Doc/reference/datamodel.rst7
4 files changed, 184 insertions, 212 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 1977d88..5cb7c22 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -34,190 +34,185 @@ provided as convenient choices for the second argument to :func:`getmembers`.
They also help you determine when you can expect to find the following special
attributes:
-+-----------+----------------------+---------------------------+
-| Type | Attribute | Description |
-+===========+======================+===========================+
-| module | __doc__ | documentation string |
-+-----------+----------------------+---------------------------+
-| | __file__ | filename (missing for |
-| | | built-in modules) |
-+-----------+----------------------+---------------------------+
-| class | __doc__ | documentation string |
-+-----------+----------------------+---------------------------+
-| | __name__ | name with which this |
-| | | class was defined |
-+-----------+----------------------+---------------------------+
-| | __qualname__ | qualified name |
-+-----------+----------------------+---------------------------+
-| | __module__ | name of module in which |
-| | | this class was defined |
-+-----------+----------------------+---------------------------+
-| | __definition_order__ | the names of the class's |
-| | | attributes, in the order |
-| | | in which they were |
-| | | defined (if known) |
-+-----------+----------------------+---------------------------+
-| method | __doc__ | documentation string |
-+-----------+----------------------+---------------------------+
-| | __name__ | name with which this |
-| | | method was defined |
-+-----------+----------------------+---------------------------+
-| | __qualname__ | qualified name |
-+-----------+----------------------+---------------------------+
-| | __func__ | function object |
-| | | containing implementation |
-| | | of method |
-+-----------+----------------------+---------------------------+
-| | __self__ | instance to which this |
-| | | method is bound, or |
-| | | ``None`` |
-+-----------+----------------------+---------------------------+
-| function | __doc__ | documentation string |
-+-----------+----------------------+---------------------------+
-| | __name__ | name with which this |
-| | | function was defined |
-+-----------+----------------------+---------------------------+
-| | __qualname__ | qualified name |
-+-----------+----------------------+---------------------------+
-| | __code__ | code object containing |
-| | | compiled function |
-| | | :term:`bytecode` |
-+-----------+----------------------+---------------------------+
-| | __defaults__ | tuple of any default |
-| | | values for positional or |
-| | | keyword parameters |
-+-----------+----------------------+---------------------------+
-| | __kwdefaults__ | mapping of any default |
-| | | values for keyword-only |
-| | | parameters |
-+-----------+----------------------+---------------------------+
-| | __globals__ | global namespace in which |
-| | | this function was defined |
-+-----------+----------------------+---------------------------+
-| | __annotations__ | mapping of parameters |
-| | | names to annotations; |
-| | | ``"return"`` key is |
-| | | reserved for return |
-| | | annotations. |
-+-----------+----------------------+---------------------------+
-| traceback | tb_frame | frame object at this |
-| | | level |
-+-----------+----------------------+---------------------------+
-| | tb_lasti | index of last attempted |
-| | | instruction in bytecode |
-+-----------+----------------------+---------------------------+
-| | tb_lineno | current line number in |
-| | | Python source code |
-+-----------+----------------------+---------------------------+
-| | tb_next | next inner traceback |
-| | | object (called by this |
-| | | level) |
-+-----------+----------------------+---------------------------+
-| frame | f_back | next outer frame object |
-| | | (this frame's caller) |
-+-----------+----------------------+---------------------------+
-| | f_builtins | builtins namespace seen |
-| | | by this frame |
-+-----------+----------------------+---------------------------+
-| | f_code | code object being |
-| | | executed in this frame |
-+-----------+----------------------+---------------------------+
-| | f_globals | global namespace seen by |
-| | | this frame |
-+-----------+----------------------+---------------------------+
-| | f_lasti | index of last attempted |
-| | | instruction in bytecode |
-+-----------+----------------------+---------------------------+
-| | f_lineno | current line number in |
-| | | Python source code |
-+-----------+----------------------+---------------------------+
-| | f_locals | local namespace seen by |
-| | | this frame |
-+-----------+----------------------+---------------------------+
-| | f_restricted | 0 or 1 if frame is in |
-| | | restricted execution mode |
-+-----------+----------------------+---------------------------+
-| | f_trace | tracing function for this |
-| | | frame, or ``None`` |
-+-----------+----------------------+---------------------------+
-| code | co_argcount | number of arguments (not |
-| | | including \* or \*\* |
-| | | args) |
-+-----------+----------------------+---------------------------+
-| | co_code | string of raw compiled |
-| | | bytecode |
-+-----------+----------------------+---------------------------+
-| | co_consts | tuple of constants used |
-| | | in the bytecode |
-+-----------+----------------------+---------------------------+
-| | co_filename | name of file in which |
-| | | this code object was |
-| | | created |
-+-----------+----------------------+---------------------------+
-| | co_firstlineno | number of first line in |
-| | | Python source code |
-+-----------+----------------------+---------------------------+
-| | co_flags | bitmap: 1=optimized ``|`` |
-| | | 2=newlocals ``|`` 4=\*arg |
-| | | ``|`` 8=\*\*arg |
-+-----------+----------------------+---------------------------+
-| | co_lnotab | encoded mapping of line |
-| | | numbers to bytecode |
-| | | indices |
-+-----------+----------------------+---------------------------+
-| | co_name | name with which this code |
-| | | object was defined |
-+-----------+----------------------+---------------------------+
-| | co_names | tuple of names of local |
-| | | variables |
-+-----------+----------------------+---------------------------+
-| | co_nlocals | number of local variables |
-+-----------+----------------------+---------------------------+
-| | co_stacksize | virtual machine stack |
-| | | space required |
-+-----------+----------------------+---------------------------+
-| | co_varnames | tuple of names of |
-| | | arguments and local |
-| | | variables |
-+-----------+----------------------+---------------------------+
-| generator | __name__ | name |
-+-----------+----------------------+---------------------------+
-| | __qualname__ | qualified name |
-+-----------+----------------------+---------------------------+
-| | gi_frame | frame |
-+-----------+----------------------+---------------------------+
-| | gi_running | is the generator running? |
-+-----------+----------------------+---------------------------+
-| | gi_code | code |
-+-----------+----------------------+---------------------------+
-| | gi_yieldfrom | object being iterated by |
-| | | ``yield from``, or |
-| | | ``None`` |
-+-----------+----------------------+---------------------------+
-| coroutine | __name__ | name |
-+-----------+----------------------+---------------------------+
-| | __qualname__ | qualified name |
-+-----------+----------------------+---------------------------+
-| | cr_await | object being awaited on, |
-| | | or ``None`` |
-+-----------+----------------------+---------------------------+
-| | cr_frame | frame |
-+-----------+----------------------+---------------------------+
-| | cr_running | is the coroutine running? |
-+-----------+----------------------+---------------------------+
-| | cr_code | code |
-+-----------+----------------------+---------------------------+
-| builtin | __doc__ | documentation string |
-+-----------+----------------------+---------------------------+
-| | __name__ | original name of this |
-| | | function or method |
-+-----------+----------------------+---------------------------+
-| | __qualname__ | qualified name |
-+-----------+----------------------+---------------------------+
-| | __self__ | instance to which a |
-| | | method is bound, or |
-| | | ``None`` |
-+-----------+----------------------+---------------------------+
++-----------+-----------------+---------------------------+
+| Type | Attribute | Description |
++===========+=================+===========================+
+| module | __doc__ | documentation string |
++-----------+-----------------+---------------------------+
+| | __file__ | filename (missing for |
+| | | built-in modules) |
++-----------+-----------------+---------------------------+
+| class | __doc__ | documentation string |
++-----------+-----------------+---------------------------+
+| | __name__ | name with which this |
+| | | class was defined |
++-----------+-----------------+---------------------------+
+| | __qualname__ | qualified name |
++-----------+-----------------+---------------------------+
+| | __module__ | name of module in which |
+| | | this class was defined |
++-----------+-----------------+---------------------------+
+| method | __doc__ | documentation string |
++-----------+-----------------+---------------------------+
+| | __name__ | name with which this |
+| | | method was defined |
++-----------+-----------------+---------------------------+
+| | __qualname__ | qualified name |
++-----------+-----------------+---------------------------+
+| | __func__ | function object |
+| | | containing implementation |
+| | | of method |
++-----------+-----------------+---------------------------+
+| | __self__ | instance to which this |
+| | | method is bound, or |
+| | | ``None`` |
++-----------+-----------------+---------------------------+
+| function | __doc__ | documentation string |
++-----------+-----------------+---------------------------+
+| | __name__ | name with which this |
+| | | function was defined |
++-----------+-----------------+---------------------------+
+| | __qualname__ | qualified name |
++-----------+-----------------+---------------------------+
+| | __code__ | code object containing |
+| | | compiled function |
+| | | :term:`bytecode` |
++-----------+-----------------+---------------------------+
+| | __defaults__ | tuple of any default |
+| | | values for positional or |
+| | | keyword parameters |
++-----------+-----------------+---------------------------+
+| | __kwdefaults__ | mapping of any default |
+| | | values for keyword-only |
+| | | parameters |
++-----------+-----------------+---------------------------+
+| | __globals__ | global namespace in which |
+| | | this function was defined |
++-----------+-----------------+---------------------------+
+| | __annotations__ | mapping of parameters |
+| | | names to annotations; |
+| | | ``"return"`` key is |
+| | | reserved for return |
+| | | annotations. |
++-----------+-----------------+---------------------------+
+| traceback | tb_frame | frame object at this |
+| | | level |
++-----------+-----------------+---------------------------+
+| | tb_lasti | index of last attempted |
+| | | instruction in bytecode |
++-----------+-----------------+---------------------------+
+| | tb_lineno | current line number in |
+| | | Python source code |
++-----------+-----------------+---------------------------+
+| | tb_next | next inner traceback |
+| | | object (called by this |
+| | | level) |
++-----------+-----------------+---------------------------+
+| frame | f_back | next outer frame object |
+| | | (this frame's caller) |
++-----------+-----------------+---------------------------+
+| | f_builtins | builtins namespace seen |
+| | | by this frame |
++-----------+-----------------+---------------------------+
+| | f_code | code object being |
+| | | executed in this frame |
++-----------+-----------------+---------------------------+
+| | f_globals | global namespace seen by |
+| | | this frame |
++-----------+-----------------+---------------------------+
+| | f_lasti | index of last attempted |
+| | | instruction in bytecode |
++-----------+-----------------+---------------------------+
+| | f_lineno | current line number in |
+| | | Python source code |
++-----------+-----------------+---------------------------+
+| | f_locals | local namespace seen by |
+| | | this frame |
++-----------+-----------------+---------------------------+
+| | f_restricted | 0 or 1 if frame is in |
+| | | restricted execution mode |
++-----------+-----------------+---------------------------+
+| | f_trace | tracing function for this |
+| | | frame, or ``None`` |
++-----------+-----------------+---------------------------+
+| code | co_argcount | number of arguments (not |
+| | | including \* or \*\* |
+| | | args) |
++-----------+-----------------+---------------------------+
+| | co_code | string of raw compiled |
+| | | bytecode |
++-----------+-----------------+---------------------------+
+| | co_consts | tuple of constants used |
+| | | in the bytecode |
++-----------+-----------------+---------------------------+
+| | co_filename | name of file in which |
+| | | this code object was |
+| | | created |
++-----------+-----------------+---------------------------+
+| | co_firstlineno | number of first line in |
+| | | Python source code |
++-----------+-----------------+---------------------------+
+| | co_flags | bitmap: 1=optimized ``|`` |
+| | | 2=newlocals ``|`` 4=\*arg |
+| | | ``|`` 8=\*\*arg |
++-----------+-----------------+---------------------------+
+| | co_lnotab | encoded mapping of line |
+| | | numbers to bytecode |
+| | | indices |
++-----------+-----------------+---------------------------+
+| | co_name | name with which this code |
+| | | object was defined |
++-----------+-----------------+---------------------------+
+| | co_names | tuple of names of local |
+| | | variables |
++-----------+-----------------+---------------------------+
+| | co_nlocals | number of local variables |
++-----------+-----------------+---------------------------+
+| | co_stacksize | virtual machine stack |
+| | | space required |
++-----------+-----------------+---------------------------+
+| | co_varnames | tuple of names of |
+| | | arguments and local |
+| | | variables |
++-----------+-----------------+---------------------------+
+| generator | __name__ | name |
++-----------+-----------------+---------------------------+
+| | __qualname__ | qualified name |
++-----------+-----------------+---------------------------+
+| | gi_frame | frame |
++-----------+-----------------+---------------------------+
+| | gi_running | is the generator running? |
++-----------+-----------------+---------------------------+
+| | gi_code | code |
++-----------+-----------------+---------------------------+
+| | gi_yieldfrom | object being iterated by |
+| | | ``yield from``, or |
+| | | ``None`` |
++-----------+-----------------+---------------------------+
+| coroutine | __name__ | name |
++-----------+-----------------+---------------------------+
+| | __qualname__ | qualified name |
++-----------+-----------------+---------------------------+
+| | cr_await | object being awaited on, |
+| | | or ``None`` |
++-----------+-----------------+---------------------------+
+| | cr_frame | frame |
++-----------+-----------------+---------------------------+
+| | cr_running | is the coroutine running? |
++-----------+-----------------+---------------------------+
+| | cr_code | code |
++-----------+-----------------+---------------------------+
+| builtin | __doc__ | documentation string |
++-----------+-----------------+---------------------------+
+| | __name__ | original name of this |
+| | | function or method |
++-----------+-----------------+---------------------------+
+| | __qualname__ | qualified name |
++-----------+-----------------+---------------------------+
+| | __self__ | instance to which a |
+| | | method is bound, or |
+| | | ``None`` |
++-----------+-----------------+---------------------------+
.. versionchanged:: 3.5
@@ -226,10 +221,6 @@ attributes:
The ``__name__`` attribute of generators is now set from the function
name, instead of the code name, and it can now be modified.
-.. versionchanged:: 3.6
-
- Add ``__definition_order__`` to classes.
-
.. function:: getmembers(object[, predicate])
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index 5eb84c1..898b95a 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -53,19 +53,13 @@ Dynamic Type Creation
in *kwds* argument with any ``'metaclass'`` entry removed. If no *kwds*
argument is passed in, this will be an empty dict.
- .. impl-detail::
-
- CPython uses :class:`collections.OrderedDict` for the default
- namespace.
-
.. versionadded:: 3.3
.. versionchanged:: 3.6
The default value for the ``namespace`` element of the returned
- tuple has changed from :func:`dict`. Now an insertion-order-
- preserving mapping is used when the metaclass does not have a
- ``__prepare__`` method,
+ tuple has changed. Now an insertion-order-preserving mapping is
+ used when the metaclass does not have a ``__prepare__`` method,
.. seealso::
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index ffdeae0..4fc6af0 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -634,15 +634,9 @@ dictionary. The class name is bound to this class object in the original local
namespace.
The order in which attributes are defined in the class body is preserved
-in the ``__definition_order__`` attribute on the new class. If that order
-is not known then the attribute is set to :const:`None`. The class body
-may include a ``__definition_order__`` attribute. In that case it is used
-directly. The value must be a tuple of identifiers or ``None``, otherwise
-:exc:`TypeError` will be raised when the class statement is executed.
-
-.. versionchanged:: 3.6
-
- Add ``__definition_order__`` to classes.
+in the new class's ``__dict__``. Note that this is reliable only right
+after the class is created and only for classes that were defined using
+the definition syntax.
Class creation can be customized heavily using :ref:`metaclasses <metaclasses>`.
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 00785ed..a075503 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1752,13 +1752,6 @@ additional keyword arguments, if any, come from the class definition).
If the metaclass has no ``__prepare__`` attribute, then the class namespace
is initialised as an empty ordered mapping.
-.. impl-detail::
-
- In CPython the default is :class:`collections.OrderedDict`.
-
-.. versionchanged:: 3.6
- Defaults to :class:`collections.OrderedDict` instead of :func:`dict`.
-
.. seealso::
:pep:`3115` - Metaclasses in Python 3000