Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.11] gh-101100: Further improve docs on function attributes (#113001)#113031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AlexWaygood merged 1 commit intopython:3.11fromAlexWaygood:backport-113001-311
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionDoc/c-api/function.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
Expand Down
7 changes: 4 additions & 3 deletionsDoc/reference/datamodel.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.

Expand All@@ -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
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp