Skip to content

Commit fdf735a

Browse files
committed
[3.11] pythongh-101100: Further improve docs on function attributes (python#113001)
(cherry-picked from commit 81a15ea)
1 parent f78f6b6 commit fdf735a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Doc/c-api/function.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ There are a few functions specific to Python functions.
3535
must be a dictionary with the global variables accessible to the function.
3636
3737
The function's docstring and name are retrieved from the code object.
38-
:func:`~function.__module__`
38+
:attr:`~function.__module__`
3939
is retrieved from *globals*. The argument defaults, annotations and closure are
4040
set to ``NULL``. :attr:`~function.__qualname__` is set to the same value as
4141
the code object's :attr:`~codeobject.co_qualname` field.

Doc/reference/datamodel.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ Most of these attributes check the type of the assigned value:
600600
or ``None`` if unavailable.
601601

602602
* - .. attribute:: function.__defaults__
603-
- A :class:`tuple` containing default parameter values
603+
- A :class:`tuple` containing default :term:`parameter` values
604604
for those parameters that have defaults,
605605
or ``None`` if no parameters have a default value.
606606

@@ -613,14 +613,15 @@ Most of these attributes check the type of the assigned value:
613613
See also: :attr:`__dict__ attributes <object.__dict__>`.
614614

615615
* - .. attribute:: function.__annotations__
616-
- A :class:`dictionary <dict>` containing annotations of parameters.
616+
- A :class:`dictionary <dict>` containing annotations of
617+
:term:`parameters <parameter>`.
617618
The keys of the dictionary are the parameter names,
618619
and ``'return'`` for the return annotation, if provided.
619620
See also: :ref:`annotations-howto`.
620621

621622
* - .. attribute:: function.__kwdefaults__
622623
- A :class:`dictionary <dict>` containing defaults for keyword-only
623-
parameters.
624+
:term:`parameters <parameter>`.
624625

625626
Function objects also support getting and setting arbitrary attributes, which
626627
can be used, for example, to attach metadata to functions. Regular attribute

0 commit comments

Comments
 (0)