@@ -17,7 +17,7 @@ adding generated :term:`special method`\s such as :meth:`__init__` and
17
17
in :pep: `557 `.
18
18
19
19
The member variables to use in these generated methods are defined
20
- using :pep: `526 ` type annotations. For example this code::
20
+ using :pep: `526 ` type annotations. For example, this code::
21
21
22
22
from dataclasses import dataclass
23
23
@@ -31,7 +31,7 @@ using :pep:`526` type annotations. For example this code::
31
31
def total_cost(self) -> float:
32
32
return self.unit_price * self.quantity_on_hand
33
33
34
- Will add, among other things, a :meth: `__init__ ` that looks like::
34
+ will add, among other things, a :meth: `__init__ ` that looks like::
35
35
36
36
def __init__(self, name: str, unit_price: float, quantity_on_hand: int = 0):
37
37
self.name = name
@@ -52,7 +52,7 @@ Module contents
52
52
:term: `special method `\s to classes, as described below.
53
53
54
54
The :func: `dataclass ` decorator examines the class to find
55
- ``field ``\s . A ``field `` is defined as class variable that has a
55
+ ``field ``\s . A ``field `` is defined as a class variable that has a
56
56
:term: `type annotation <variable annotation> `. With two
57
57
exceptions described below, nothing in :func: `dataclass `
58
58
examines the type specified in the variable annotation.
@@ -62,8 +62,8 @@ Module contents
62
62
63
63
The :func: `dataclass ` decorator will add various "dunder" methods to
64
64
the class, described below. If any of the added methods already
65
- exist on the class, the behavior depends on the parameter, as documented
66
- below. The decorator returns the same class that is called on; no new
65
+ exist in the class, the behavior depends on the parameter, as documented
66
+ below. The decorator returns the same class that it is called on; no new
67
67
class is created.
68
68
69
69
If :func: `dataclass ` is used just as a simple decorator with no parameters,
@@ -202,7 +202,7 @@ Module contents
202
202
def __init__(self, a: int, b: int = 0):
203
203
204
204
:exc: `TypeError ` will be raised if a field without a default value
205
- follows a field with a default value. This is true either when this
205
+ follows a field with a default value. This is true whether this
206
206
occurs in a single class, or as a result of class inheritance.
207
207
208
208
.. function :: field(*, default=MISSING, default_factory=MISSING, init=True, repr=True, hash=None, compare=True, metadata=None, kw_only=MISSING):
@@ -395,7 +395,7 @@ Module contents
395
395
396
396
.. function :: replace(instance, /, **changes)
397
397
398
- Creates a new object of the same type of ``instance ``, replacing
398
+ Creates a new object of the same type as ``instance ``, replacing
399
399
fields with values from ``changes ``. If ``instance `` is not a Data
400
400
Class, raises :exc: `TypeError `. If values in ``changes `` do not
401
401
specify fields, raises :exc: `TypeError `.
0 commit comments