diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2012-05-30 12:17:30 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-05-30 12:17:30 (GMT) |
commit | a0cf90e3b1bebde4dea8b99083830b9fb209a1c0 (patch) | |
tree | 0b4fe895c668b30a828898aef583f409006712cd /Doc | |
parent | bb7567800318888bb60926686d90f3e2d942a20f (diff) | |
download | cpython-a0cf90e3b1bebde4dea8b99083830b9fb209a1c0.zip cpython-a0cf90e3b1bebde4dea8b99083830b9fb209a1c0.tar.gz cpython-a0cf90e3b1bebde4dea8b99083830b9fb209a1c0.tar.bz2 |
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
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/types.rst | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/Doc/library/types.rst b/Doc/library/types.rst index 161d854..fc26afa 100644 --- a/Doc/library/types.rst +++ b/Doc/library/types.rst @@ -23,12 +23,15 @@ Dynamic Type Creation Creates a class object dynamically using the appropriate metaclass. - The arguments are the components that make up a class definition: the - class name, the base classes (in order), the keyword arguments (such as - ``metaclass``) and the callback function to populate the class namespace. + The first three arguments are the components that make up a class + definition header: the class name, the base classes (in order), the + keyword arguments (such as ``metaclass``). - The *exec_body* callback should accept the class namespace as its sole - argument and update the namespace directly with the class contents. + The *exec_body* argument is a callback that is used to populate the + 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 @@ -36,22 +39,24 @@ Dynamic Type Creation Calculates the appropriate metaclass and creates the class namespace. - The arguments are the components that make up a class definition: the - class name, the base classes (in order) and the keyword arguments (such as - ``metaclass``). + The arguments are the components that make up a class definition header: + the class name, the base classes (in order) and the keyword arguments + (such as ``metaclass``). The return value is a 3-tuple: ``metaclass, namespace, kwds`` - *metaclass* is the appropriate metaclass - *namespace* is the prepared class namespace - *kwds* is an updated copy of the passed in *kwds* argument with any - ``'metaclass'`` entry removed. If no *kwds* argument is passed in, this - will be an empty dict. + *metaclass* is the appropriate metaclass, *namespace* is the + prepared class namespace and *kwds* is an updated copy of the passed + in *kwds* argument with any ``'metaclass'`` entry removed. If no *kwds* + argument is passed in, this will be an empty dict. .. versionadded:: 3.3 .. seealso:: + :ref:`metaclasses` + Full details of the class creation process supported by these functions + :pep:`3115` - Metaclasses in Python 3000 Introduced the ``__prepare__`` namespace hook |