diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-05-06 21:54:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-06 21:54:32 (GMT) |
commit | ba5076f34ba3ad5252e29b55727c5c95576e7310 (patch) | |
tree | 1dc56ffa35717c83f7b0a90488707a03f94c07d9 | |
parent | fbefdaf92e40134c43142c182f7c5bfe406e4c2b (diff) | |
download | cpython-ba5076f34ba3ad5252e29b55727c5c95576e7310.zip cpython-ba5076f34ba3ad5252e29b55727c5c95576e7310.tar.gz cpython-ba5076f34ba3ad5252e29b55727c5c95576e7310.tar.bz2 |
Fix minor grammar problems in dataclasses documentation (GH-25948) (GH-25958)
Some missing words; some odd word choices.
(cherry picked from commit ee8e7c2fa950f88ba2c33035bea7aed7aaf0cb77)
Co-authored-by: Scott Noyes <snoyes@gmail.com>
Co-authored-by: Scott Noyes <snoyes@gmail.com>
-rw-r--r-- | Doc/library/dataclasses.rst | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 64540b3..f06763f 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -17,7 +17,7 @@ adding generated :term:`special method`\s such as :meth:`__init__` and in :pep:`557`. The member variables to use in these generated methods are defined -using :pep:`526` type annotations. For example this code:: +using :pep:`526` type annotations. For example, this code:: from dataclasses import dataclass @@ -31,7 +31,7 @@ using :pep:`526` type annotations. For example this code:: def total_cost(self) -> float: return self.unit_price * self.quantity_on_hand -Will add, among other things, a :meth:`__init__` that looks like:: +will add, among other things, a :meth:`__init__` that looks like:: def __init__(self, name: str, unit_price: float, quantity_on_hand: int = 0): self.name = name @@ -52,7 +52,7 @@ Module contents :term:`special method`\s to classes, as described below. The :func:`dataclass` decorator examines the class to find - ``field``\s. A ``field`` is defined as class variable that has a + ``field``\s. A ``field`` is defined as a class variable that has a :term:`type annotation <variable annotation>`. With two exceptions described below, nothing in :func:`dataclass` examines the type specified in the variable annotation. @@ -62,8 +62,8 @@ Module contents The :func:`dataclass` decorator will add various "dunder" methods to the class, described below. If any of the added methods already - exist on the class, the behavior depends on the parameter, as documented - below. The decorator returns the same class that is called on; no new + exist in the class, the behavior depends on the parameter, as documented + below. The decorator returns the same class that it is called on; no new class is created. If :func:`dataclass` is used just as a simple decorator with no parameters, @@ -202,7 +202,7 @@ Module contents def __init__(self, a: int, b: int = 0): :exc:`TypeError` will be raised if a field without a default value - follows a field with a default value. This is true either when this + follows a field with a default value. This is true whether this occurs in a single class, or as a result of class inheritance. .. 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 .. function:: replace(instance, /, **changes) - Creates a new object of the same type of ``instance``, replacing + Creates a new object of the same type as ``instance``, replacing fields with values from ``changes``. If ``instance`` is not a Data Class, raises :exc:`TypeError`. If values in ``changes`` do not specify fields, raises :exc:`TypeError`. |