@@ -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,21 +157,21 @@ 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
:attr: `~object.__match_args__ ` tuple will be created from the list of
167
167
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
169
169
:attr: `!__match_args__ ` is already defined in the class, then
170
170
:attr: `!__match_args__ ` will not be generated.
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
@@ -183,7 +183,7 @@ Module contents
183
183
184
184
.. versionadded :: 3.10
185
185
186
- - *slots *: If true (the default is ``False ``), :attr: `~object.__slots__ ` attribute
186
+ - *slots *: If `` True `` (the default is ``False ``), :attr: `~object.__slots__ ` attribute
187
187
will be generated and new class will be returned instead of the original one.
188
188
If :attr: `!__slots__ ` is already defined in the class, then :exc: `TypeError `
189
189
is raised.
@@ -207,7 +207,7 @@ Module contents
207
207
base class :attr: `!__slots__ ` may be any iterable, but *not * an iterator.
208
208
209
209
210
- - *weakref_slot *: If true (the default is ``False ``), add a slot
210
+ - *weakref_slot *: If `` True `` (the default is ``False ``), add a slot
211
211
named "__weakref__", which is required to make an instance
212
212
:func: `weakref-able <weakref.ref> `.
213
213
It is an error to specify ``weakref_slot=True ``
@@ -264,14 +264,14 @@ Module contents
264
264
fields with mutable default values, as discussed below. It is an
265
265
error to specify both *default * and *default_factory *.
266
266
267
- - *init *: If true (the default), this field is included as a
267
+ - *init *: If `` True `` (the default), this field is included as a
268
268
parameter to the generated :meth: `~object.__init__ ` method.
269
269
270
- - *repr *: If true (the default), this field is included in the
270
+ - *repr *: If `` True `` (the default), this field is included in the
271
271
string returned by the generated :meth: `~object.__repr__ ` method.
272
272
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 `` ,
275
275
this field is excluded from the generated :meth: `~object.__hash__ `.
276
276
If ``None `` (the default), use the value of *compare *: this would
277
277
normally be the expected behavior, since a field should be included
@@ -284,7 +284,7 @@ Module contents
284
284
fields that contribute to the type's hash value. Even if a field
285
285
is excluded from the hash, it will still be used for comparisons.
286
286
287
- - *compare *: If true (the default), this field is included in the
287
+ - *compare *: If `` True `` (the default), this field is included in the
288
288
generated equality and comparison methods (:meth: `~object.__eq__ `,
289
289
:meth: `~object.__gt__ `, et al.).
290
290
@@ -296,7 +296,7 @@ Module contents
296
296
Multiple third-parties can each have their own key, to use as a
297
297
namespace in the metadata.
298
298
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.
300
300
This is used when the generated :meth: `~object.__init__ ` method's
301
301
parameters are computed.
302
302
0 commit comments