Commit a0cf90e3 authored by Nick Coghlan's avatar Nick Coghlan

Close #14947: add missing cross-reference to Language Definition from the new...

Close #14947: add missing cross-reference to Language Definition from the new dynamic type creation functions. Also cleaned up the general wording of the docs
parent bb756780
...@@ -23,12 +23,15 @@ Dynamic Type Creation ...@@ -23,12 +23,15 @@ Dynamic Type Creation
Creates a class object dynamically using the appropriate metaclass. Creates a class object dynamically using the appropriate metaclass.
The arguments are the components that make up a class definition: the The first three arguments are the components that make up a class
class name, the base classes (in order), the keyword arguments (such as definition header: the class name, the base classes (in order), the
``metaclass``) and the callback function to populate the class namespace. keyword arguments (such as ``metaclass``).
The *exec_body* callback should accept the class namespace as its sole The *exec_body* argument is a callback that is used to populate the
argument and update the namespace directly with the class contents. freshly created class namespace. It should accept the class namespace
as its sole argument and update the namespace directly with the class
contents. If no callback is provided, it has the same effect as passing
in ``lambda ns: ns``.
.. versionadded:: 3.3 .. versionadded:: 3.3
...@@ -36,22 +39,24 @@ Dynamic Type Creation ...@@ -36,22 +39,24 @@ Dynamic Type Creation
Calculates the appropriate metaclass and creates the class namespace. Calculates the appropriate metaclass and creates the class namespace.
The arguments are the components that make up a class definition: the The arguments are the components that make up a class definition header:
class name, the base classes (in order) and the keyword arguments (such as the class name, the base classes (in order) and the keyword arguments
``metaclass``). (such as ``metaclass``).
The return value is a 3-tuple: ``metaclass, namespace, kwds`` The return value is a 3-tuple: ``metaclass, namespace, kwds``
*metaclass* is the appropriate metaclass *metaclass* is the appropriate metaclass, *namespace* is the
*namespace* is the prepared class namespace prepared class namespace and *kwds* is an updated copy of the passed
*kwds* is an updated copy of the passed in *kwds* argument with any in *kwds* argument with any ``'metaclass'`` entry removed. If no *kwds*
``'metaclass'`` entry removed. If no *kwds* argument is passed in, this argument is passed in, this will be an empty dict.
will be an empty dict.
.. versionadded:: 3.3 .. versionadded:: 3.3
.. seealso:: .. seealso::
:ref:`metaclasses`
Full details of the class creation process supported by these functions
:pep:`3115` - Metaclasses in Python 3000 :pep:`3115` - Metaclasses in Python 3000
Introduced the ``__prepare__`` namespace hook Introduced the ``__prepare__`` namespace hook
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment