mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #24254: Drop cls.__definition_order__.
This commit is contained in:
parent
7f730cf01d
commit
4f29e75289
16 changed files with 193 additions and 533 deletions
|
@ -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>`.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue