From 30991cc0fac6fcfff93ee1775ac7b371389b1447 Mon Sep 17 00:00:00 2001 From: Kian Meng Ang Date: Thu, 21 Oct 2021 23:52:19 +0800 Subject: [PATCH] Fix typos (#169) --- data-classes.rst | 2 +- dataclasses.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data-classes.rst b/data-classes.rst index 31f2ade..dfecbc6 100644 --- a/data-classes.rst +++ b/data-classes.rst @@ -138,7 +138,7 @@ Issues - Use inheritance, metaclasses, or decorators? Implementation detail, decide after we finalize our goals. -- Should we explicitely support "shared" mutable defaults? Like +- Should we explicitly support "shared" mutable defaults? Like __init__(self, x=[]). I think so. That is, we shouldn't do something like try to detect mutable defaults and implicitly copy them. diff --git a/dataclasses.py b/dataclasses.py index ddd59c6..98e7223 100644 --- a/dataclasses.py +++ b/dataclasses.py @@ -257,7 +257,7 @@ def __repr__(self): # This is used to support the PEP 487 __set_name__ protocol in the # case where we're using a field that contains a descriptor as a - # defaul value. For details on __set_name__, see + # default value. For details on __set_name__, see # https://www.python.org/dev/peps/pep-0487/#implementation-details. # # Note that in _process_class, this Field object is overwritten @@ -643,7 +643,7 @@ def _get_field(cls, a_name, a_type): # In addition to checking for actual types here, also check for # string annotations. get_type_hints() won't always work for us # (see https://github.com/python/typing/issues/508 for example), - # plus it's expensive and would require an eval for every stirng + # plus it's expensive and would require an eval for every string # annotation. So, make a best effort to see if this is a ClassVar # or InitVar using regex's and checking that the thing referenced # is actually of the correct type. @@ -1116,7 +1116,7 @@ class C(Base): raise TypeError(f'Invalid field: {item!r}') if not isinstance(name, str) or not name.isidentifier(): - raise TypeError(f'Field names must be valid identifers: {name!r}') + raise TypeError(f'Field names must be valid identifiers: {name!r}') if keyword.iskeyword(name): raise TypeError(f'Field names must not be keywords: {name!r}') if name in seen: