Skip to content

Commit 060dd93

Browse files
committed
Docs: fix formatting in dataclasses.rst
Correct boolean literals by replacing 'true' with '``True``' for accuracy and consistency. Resolves gh-134946
1 parent 8865b4f commit 060dd93

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Doc/library/dataclasses.rst

Lines changed: 16 additions & 16 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,21 +157,21 @@ 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
:attr:`~object.__match_args__` tuple will be created from the list of
167167
non keyword-only parameters to the generated :meth:`~object.__init__` method (even if
168-
:meth:`!__init__` is not generated, see above). If false, or if
168+
: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.
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
@@ -183,7 +183,7 @@ Module contents
183183

184184
.. versionadded:: 3.10
185185

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

209209

210-
- *weakref_slot*: If true (the default is ``False``), add a slot
210+
- *weakref_slot*: If ``True`` (the default is ``False``), add a slot
211211
named "__weakref__", which is required to make an instance
212212
:func:`weakref-able <weakref.ref>`.
213213
It is an error to specify ``weakref_slot=True``
@@ -264,14 +264,14 @@ Module contents
264264
fields with mutable default values, as discussed below. It is an
265265
error to specify both *default* and *default_factory*.
266266

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

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

273-
- *hash*: This can be a bool or ``None``. If true, this field is
274-
included in the generated :meth:`~object.__hash__` method. If false,
273+
- *hash*: This can be a bool or ``None``. If ``True``, this field is
274+
included in the generated :meth:`~object.__hash__` method. If ``False``,
275275
this field is excluded from the generated :meth:`~object.__hash__`.
276276
If ``None`` (the default), use the value of *compare*: this would
277277
normally be the expected behavior, since a field should be included
@@ -284,7 +284,7 @@ Module contents
284284
fields that contribute to the type's hash value. Even if a field
285285
is excluded from the hash, it will still be used for comparisons.
286286

287-
- *compare*: If true (the default), this field is included in the
287+
- *compare*: If ``True`` (the default), this field is included in the
288288
generated equality and comparison methods (:meth:`~object.__eq__`,
289289
:meth:`~object.__gt__`, et al.).
290290

@@ -296,7 +296,7 @@ Module contents
296296
Multiple third-parties can each have their own key, to use as a
297297
namespace in the metadata.
298298

299-
- *kw_only*: If true, this field will be marked as keyword-only.
299+
- *kw_only*: If ``True``, this field will be marked as keyword-only.
300300
This is used when the generated :meth:`~object.__init__` method's
301301
parameters are computed.
302302

0 commit comments

Comments
 (0)