@@ -86,13 +86,13 @@ Module contents
86
86
87
87
The parameters to ``@dataclass `` are:
88
88
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
90
90
generated.
91
91
92
92
If the class already defines :meth: `!__init__ `, this parameter is
93
93
ignored.
94
94
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
96
96
generated. The generated repr string will have the class name and
97
97
the name and repr of each field, in the order they are defined in
98
98
the class. Fields that are marked as being excluded from the repr
@@ -102,15 +102,15 @@ Module contents
102
102
If the class already defines :meth: `!__repr__ `, this parameter is
103
103
ignored.
104
104
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
106
106
generated. This method compares the class as if it were a tuple
107
107
of its fields, in order. Both instances in the comparison must
108
108
be of the identical type.
109
109
110
110
If the class already defines :meth: `!__eq__ `, this parameter is
111
111
ignored.
112
112
113
- - ``order ``: If true (the default is ``False ``), :meth: `~object.__lt__ `,
113
+ - ``order ``: If `` True `` (the default is ``False ``), :meth: `~object.__lt__ `,
114
114
:meth: `~object.__le__ `, :meth: `~object.__gt__ `, and :meth: `~object.__ge__ ` methods will be
115
115
generated. These compare the class as if it were a tuple of its
116
116
fields, in order. Both instances in the comparison must be of the
@@ -157,12 +157,12 @@ Module contents
157
157
method of the superclass will be used (if the superclass is
158
158
:class: `object `, this means it will fall back to id-based hashing).
159
159
160
- - ``frozen ``: If true (the default is ``False ``), assigning to fields will
160
+ - ``frozen ``: If `` True `` (the default is ``False ``), assigning to fields will
161
161
generate an exception. This emulates read-only frozen instances. If
162
162
:meth: `~object.__setattr__ ` or :meth: `~object.__delattr__ ` is defined in the class, then
163
163
:exc: `TypeError ` is raised. See the discussion below.
164
164
165
- - ``match_args ``: If true (the default is ``True ``), the
165
+ - ``match_args ``: If `` True `` (the default is ``True ``), the
166
166
``__match_args__ `` tuple will be created from the list of
167
167
parameters to the generated :meth: `~object.__init__ ` method (even if
168
168
:meth: `!__init__ ` is not generated, see above). If false, or if
@@ -171,7 +171,7 @@ Module contents
171
171
172
172
.. versionadded :: 3.10
173
173
174
- - ``kw_only ``: If true (the default value is ``False ``), then all
174
+ - ``kw_only ``: If `` True `` (the default value is ``False ``), then all
175
175
fields will be marked as keyword-only. If a field is marked as
176
176
keyword-only, then the only effect is that the :meth: `~object.__init__ `
177
177
parameter generated from a keyword-only field must be specified
@@ -182,7 +182,7 @@ Module contents
182
182
183
183
.. versionadded :: 3.10
184
184
185
- - ``slots ``: If true (the default is ``False ``), :attr: `~object.__slots__ ` attribute
185
+ - ``slots ``: If `` True `` (the default is ``False ``), :attr: `~object.__slots__ ` attribute
186
186
will be generated and new class will be returned instead of the original one.
187
187
If :attr: `!__slots__ ` is already defined in the class, then :exc: `TypeError `
188
188
is raised.
@@ -199,7 +199,7 @@ Module contents
199
199
base class ``__slots__ `` may be any iterable, but *not * an iterator.
200
200
201
201
202
- - ``weakref_slot ``: If true (the default is ``False ``), add a slot
202
+ - ``weakref_slot ``: If `` True `` (the default is ``False ``), add a slot
203
203
named "__weakref__", which is required to make an instance
204
204
weakref-able. It is an error to specify ``weakref_slot=True ``
205
205
without also specifying ``slots=True ``.
@@ -255,13 +255,13 @@ Module contents
255
255
fields with mutable default values, as discussed below. It is an
256
256
error to specify both ``default `` and ``default_factory ``.
257
257
258
- - ``init ``: If true (the default), this field is included as a
258
+ - ``init ``: If `` True `` (the default), this field is included as a
259
259
parameter to the generated :meth: `~object.__init__ ` method.
260
260
261
- - ``repr ``: If true (the default), this field is included in the
261
+ - ``repr ``: If `` True `` (the default), this field is included in the
262
262
string returned by the generated :meth: `~object.__repr__ ` method.
263
263
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
265
265
included in the generated :meth: `~object.__hash__ ` method. If ``None `` (the
266
266
default), use the value of ``compare ``: this would normally be
267
267
the expected behavior. A field should be considered in the hash
@@ -274,7 +274,7 @@ Module contents
274
274
fields that contribute to the type's hash value. Even if a field
275
275
is excluded from the hash, it will still be used for comparisons.
276
276
277
- - ``compare ``: If true (the default), this field is included in the
277
+ - ``compare ``: If `` True `` (the default), this field is included in the
278
278
generated equality and comparison methods (:meth: `~object.__eq__ `,
279
279
:meth: `~object.__gt__ `, et al.).
280
280
@@ -286,7 +286,7 @@ Module contents
286
286
Multiple third-parties can each have their own key, to use as a
287
287
namespace in the metadata.
288
288
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.
290
290
This is used when the generated :meth: `~object.__init__ ` method's
291
291
parameters are computed.
292
292
0 commit comments