Skip to content

Commit ee8e7c2

Browse files
authored
Fix minor grammar problems in dataclasses documentation (GH-25948)
Some missing words; some odd word choices.
1 parent 92ceb1c commit ee8e7c2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Doc/library/dataclasses.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ adding generated :term:`special method`\s such as :meth:`__init__` and
1717
in :pep:`557`.
1818

1919
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::
2121

2222
from dataclasses import dataclass
2323

@@ -31,7 +31,7 @@ using :pep:`526` type annotations. For example this code::
3131
def total_cost(self) -> float:
3232
return self.unit_price * self.quantity_on_hand
3333

34-
Will add, among other things, a :meth:`__init__` that looks like::
34+
will add, among other things, a :meth:`__init__` that looks like::
3535

3636
def __init__(self, name: str, unit_price: float, quantity_on_hand: int = 0):
3737
self.name = name
@@ -52,7 +52,7 @@ Module contents
5252
:term:`special method`\s to classes, as described below.
5353

5454
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
5656
:term:`type annotation <variable annotation>`. With two
5757
exceptions described below, nothing in :func:`dataclass`
5858
examines the type specified in the variable annotation.
@@ -62,8 +62,8 @@ Module contents
6262

6363
The :func:`dataclass` decorator will add various "dunder" methods to
6464
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
6767
class is created.
6868

6969
If :func:`dataclass` is used just as a simple decorator with no parameters,
@@ -202,7 +202,7 @@ Module contents
202202
def __init__(self, a: int, b: int = 0):
203203

204204
: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
206206
occurs in a single class, or as a result of class inheritance.
207207

208208
.. 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
395395

396396
.. function:: replace(instance, /, **changes)
397397

398-
Creates a new object of the same type of ``instance``, replacing
398+
Creates a new object of the same type as ``instance``, replacing
399399
fields with values from ``changes``. If ``instance`` is not a Data
400400
Class, raises :exc:`TypeError`. If values in ``changes`` do not
401401
specify fields, raises :exc:`TypeError`.

0 commit comments

Comments
 (0)