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

Appearance settings

Commit 0875dcb

Browse filesBrowse files
[3.12] gh-132221: Fix __match_args__ generation docs in dataclasses.rst (GH-132222) (#132227)
gh-132221: Fix `__match_args__` generation docs in `dataclasses.rst` (GH-132222) (cherry picked from commit 8b62374) Co-authored-by: sobolevn <mail@sobolevn.me>
1 parent 33834cb commit 0875dcb
Copy full SHA for 0875dcb

File tree

Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed

‎Doc/library/dataclasses.rst

Copy file name to clipboardExpand all lines: Doc/library/dataclasses.rst
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Module contents
164164

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

182+
Keyword-only fields are not included in :attr:`!__match_args__`.
183+
183184
.. versionadded:: 3.10
184185

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

310+
Keyword-only fields are also not included in :attr:`!__match_args__`.
311+
309312
.. versionadded:: 3.10
310313

311314
If the default value of a field is specified by a call to

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.