]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-101100: Further improve docs on function attributes (#113001) (#113031)
authorAlex Waygood <Alex.Waygood@Gmail.com>
Tue, 12 Dec 2023 20:36:51 +0000 (20:36 +0000)
committerGitHub <noreply@github.com>
Tue, 12 Dec 2023 20:36:51 +0000 (20:36 +0000)
(cherry-picked from commit 81a15ea74e)

Doc/c-api/function.rst
Doc/reference/datamodel.rst

index a6a864ed8a3b4704ef6205ee50da3ffca75f0097..805c84607bd8395096a5f477896f5e2b28a6e7a9 100644 (file)
@@ -35,7 +35,7 @@ There are a few functions specific to Python functions.
    must be a dictionary with the global variables accessible to the function.
 
    The function's docstring and name are retrieved from the code object.
-   :func:`~function.__module__`
+   :attr:`~function.__module__`
    is retrieved from *globals*. The argument defaults, annotations and closure are
    set to ``NULL``. :attr:`~function.__qualname__` is set to the same value as
    the code object's :attr:`~codeobject.co_qualname` field.
index a47e59885851448964458297952f0933ce807c47..735827aff078ba5d80031fa9902074c91b7e4090 100644 (file)
@@ -600,7 +600,7 @@ Most of these attributes check the type of the assigned value:
        or ``None`` if unavailable.
 
    * - .. attribute:: function.__defaults__
-     - A :class:`tuple` containing default parameter values
+     - A :class:`tuple` containing default :term:`parameter` values
        for those parameters that have defaults,
        or ``None`` if no parameters have a default value.
 
@@ -613,14 +613,15 @@ Most of these attributes check the type of the assigned value:
        See also: :attr:`__dict__ attributes <object.__dict__>`.
 
    * - .. attribute:: function.__annotations__
-     - A :class:`dictionary <dict>` containing annotations of parameters.
+     - A :class:`dictionary <dict>` containing annotations of
+       :term:`parameters <parameter>`.
        The keys of the dictionary are the parameter names,
        and ``'return'`` for the return annotation, if provided.
        See also: :ref:`annotations-howto`.
 
    * - .. attribute:: function.__kwdefaults__
      - A :class:`dictionary <dict>` containing defaults for keyword-only
-       parameters.
+       :term:`parameters <parameter>`.
 
 Function objects also support getting and setting arbitrary attributes, which
 can be used, for example, to attach metadata to functions.  Regular attribute