Skip to content

[3.12] gh-132221: Fix __match_args__ generation docs in dataclasses.rst (GH-132222) #132227

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Changes from all 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
11 changes: 7 additions & 4 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Module contents

- *match_args*: If true (the default is ``True``), the
:attr:`~object.__match_args__` tuple will be created from the list of
parameters to the generated :meth:`~object.__init__` method (even if
non keyword-only parameters to the generated :meth:`~object.__init__` method (even if
:meth:`!__init__` is not generated, see above). If false, or if
:attr:`!__match_args__` is already defined in the class, then
:attr:`!__match_args__` will not be generated.
Expand All @@ -175,11 +175,12 @@ Module contents
fields will be marked as keyword-only. If a field is marked as
keyword-only, then the only effect is that the :meth:`~object.__init__`
parameter generated from a keyword-only field must be specified
with a keyword when :meth:`!__init__` is called. There is no
effect on any other aspect of dataclasses. See the
:term:`parameter` glossary entry for details. Also see the
with a keyword when :meth:`!__init__` is called. See the :term:`parameter`
glossary entry for details. Also see the
:const:`KW_ONLY` section.

Keyword-only fields are not included in :attr:`!__match_args__`.

.. versionadded:: 3.10

- *slots*: If true (the default is ``False``), :attr:`~object.__slots__` attribute
Expand Down Expand Up @@ -306,6 +307,8 @@ Module contents
This is used when the generated :meth:`~object.__init__` method's
parameters are computed.

Keyword-only fields are also not included in :attr:`!__match_args__`.

.. versionadded:: 3.10

If the default value of a field is specified by a call to
Expand Down
Loading