Skip to content

Commit 9eb96a7

Browse files
committed
Docs: fix formatting in dataclasses.rst
Fix boolean values formatting by using double backticks for True/False to improve consistency. Fixes gh-134946
1 parent bfc57d4 commit 9eb96a7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Doc/library/dataclasses.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ Module contents
8686

8787
The parameters to ``@dataclass`` are:
8888

89-
- ``init``: If true (the default), a :meth:`~object.__init__` method will be
89+
- ``init``: If ``True`` (the default), a :meth:`~object.__init__` method will be
9090
generated.
9191

9292
If the class already defines :meth:`!__init__`, this parameter is
9393
ignored.
9494

95-
- ``repr``: If true (the default), a :meth:`~object.__repr__` method will be
95+
- ``repr``: If ``True`` (the default), a :meth:`~object.__repr__` method will be
9696
generated. The generated repr string will have the class name and
9797
the name and repr of each field, in the order they are defined in
9898
the class. Fields that are marked as being excluded from the repr
@@ -102,15 +102,15 @@ Module contents
102102
If the class already defines :meth:`!__repr__`, this parameter is
103103
ignored.
104104

105-
- ``eq``: If true (the default), an :meth:`~object.__eq__` method will be
105+
- ``eq``: If ``True`` (the default), an :meth:`~object.__eq__` method will be
106106
generated. This method compares the class as if it were a tuple
107107
of its fields, in order. Both instances in the comparison must
108108
be of the identical type.
109109

110110
If the class already defines :meth:`!__eq__`, this parameter is
111111
ignored.
112112

113-
- ``order``: If true (the default is ``False``), :meth:`~object.__lt__`,
113+
- ``order``: If ``True`` (the default is ``False``), :meth:`~object.__lt__`,
114114
:meth:`~object.__le__`, :meth:`~object.__gt__`, and :meth:`~object.__ge__` methods will be
115115
generated. These compare the class as if it were a tuple of its
116116
fields, in order. Both instances in the comparison must be of the
@@ -157,12 +157,12 @@ Module contents
157157
method of the superclass will be used (if the superclass is
158158
:class:`object`, this means it will fall back to id-based hashing).
159159

160-
- ``frozen``: If true (the default is ``False``), assigning to fields will
160+
- ``frozen``: If ``True`` (the default is ``False``), assigning to fields will
161161
generate an exception. This emulates read-only frozen instances. If
162162
:meth:`~object.__setattr__` or :meth:`~object.__delattr__` is defined in the class, then
163163
:exc:`TypeError` is raised. See the discussion below.
164164

165-
- ``match_args``: If true (the default is ``True``), the
165+
- ``match_args``: If ``True`` (the default is ``True``), the
166166
``__match_args__`` tuple will be created from the list of
167167
parameters to the generated :meth:`~object.__init__` method (even if
168168
:meth:`!__init__` is not generated, see above). If false, or if
@@ -171,7 +171,7 @@ Module contents
171171

172172
.. versionadded:: 3.10
173173

174-
- ``kw_only``: If true (the default value is ``False``), then all
174+
- ``kw_only``: If ``True`` (the default value is ``False``), then all
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
@@ -182,7 +182,7 @@ Module contents
182182

183183
.. versionadded:: 3.10
184184

185-
- ``slots``: If true (the default is ``False``), :attr:`~object.__slots__` attribute
185+
- ``slots``: If ``True`` (the default is ``False``), :attr:`~object.__slots__` attribute
186186
will be generated and new class will be returned instead of the original one.
187187
If :attr:`!__slots__` is already defined in the class, then :exc:`TypeError`
188188
is raised.
@@ -199,7 +199,7 @@ Module contents
199199
base class ``__slots__`` may be any iterable, but *not* an iterator.
200200

201201

202-
- ``weakref_slot``: If true (the default is ``False``), add a slot
202+
- ``weakref_slot``: If ``True`` (the default is ``False``), add a slot
203203
named "__weakref__", which is required to make an instance
204204
weakref-able. It is an error to specify ``weakref_slot=True``
205205
without also specifying ``slots=True``.
@@ -255,13 +255,13 @@ Module contents
255255
fields with mutable default values, as discussed below. It is an
256256
error to specify both ``default`` and ``default_factory``.
257257

258-
- ``init``: If true (the default), this field is included as a
258+
- ``init``: If ``True`` (the default), this field is included as a
259259
parameter to the generated :meth:`~object.__init__` method.
260260

261-
- ``repr``: If true (the default), this field is included in the
261+
- ``repr``: If ``True`` (the default), this field is included in the
262262
string returned by the generated :meth:`~object.__repr__` method.
263263

264-
- ``hash``: This can be a bool or ``None``. If true, this field is
264+
- ``hash``: This can be a bool or ``None``. If ``True``, this field is
265265
included in the generated :meth:`~object.__hash__` method. If ``None`` (the
266266
default), use the value of ``compare``: this would normally be
267267
the expected behavior. A field should be considered in the hash
@@ -274,7 +274,7 @@ Module contents
274274
fields that contribute to the type's hash value. Even if a field
275275
is excluded from the hash, it will still be used for comparisons.
276276

277-
- ``compare``: If true (the default), this field is included in the
277+
- ``compare``: If ``True`` (the default), this field is included in the
278278
generated equality and comparison methods (:meth:`~object.__eq__`,
279279
:meth:`~object.__gt__`, et al.).
280280

@@ -286,7 +286,7 @@ Module contents
286286
Multiple third-parties can each have their own key, to use as a
287287
namespace in the metadata.
288288

289-
- ``kw_only``: If true, this field will be marked as keyword-only.
289+
- ``kw_only``: If ``True``, this field will be marked as keyword-only.
290290
This is used when the generated :meth:`~object.__init__` method's
291291
parameters are computed.
292292

0 commit comments

Comments
 (0)