Skip to content

Commit 75d0d30

Browse files
authored
A few typo fixes (#1750)
1 parent 2e70529 commit 75d0d30

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/source/generics.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,15 @@ For class methods, you can also define generic ``cls``, using :py:class:`type`:
259259

260260
.. code-block:: python
261261
262-
from typing import TypeVar, Type
262+
from typing import Optional, TypeVar, Type
263263
264264
T = TypeVar('T', bound='Friend')
265265
266266
class Friend:
267-
other: "Friend" = None
267+
other: Optional["Friend"] = None
268268
269269
@classmethod
270-
def make_pair(cls: Type[T]) -> tuple[T, T]:
270+
def make_pair(cls: type[T]) -> tuple[T, T]:
271271
a, b = cls(), cls()
272272
a.other = b
273273
b.other = a
@@ -674,19 +674,19 @@ alter the signature of the input function:
674674
P = ParamSpec('P')
675675
T = TypeVar('T')
676676
677-
# We reuse 'P' in the return type, but replace 'T' with 'str'
677+
# We reuse 'P' in the return type, but replace 'T' with 'str'
678678
def stringify(func: Callable[P, T]) -> Callable[P, str]:
679679
def wrapper(*args: P.args, **kwds: P.kwargs) -> str:
680680
return str(func(*args, **kwds))
681681
return wrapper
682682
683-
@stringify
684-
def add_forty_two(value: int) -> int:
685-
return value + 42
683+
@stringify
684+
def add_forty_two(value: int) -> int:
685+
return value + 42
686686
687-
a = add_forty_two(3)
688-
reveal_type(a) # Revealed type is "builtins.str"
689-
add_forty_two('x') # error: Argument 1 to "add_forty_two" has incompatible type "str"; expected "int"
687+
a = add_forty_two(3)
688+
reveal_type(a) # Revealed type is "builtins.str"
689+
add_forty_two('x') # error: Argument 1 to "add_forty_two" has incompatible type "str"; expected "int"
690690
691691
Or insert an argument:
692692

docs/source/libraries.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ encouraged to use some of the new type-friendly classes.
608608
NamedTuple (described in :pep:`484`) is preferred over
609609
namedtuple.
610610

611-
Data classes (described in :pep:`557`) is preferred over
611+
Data classes (described in :pep:`557`) are preferred over
612612
untyped dictionaries.
613613

614614
TypedDict (described in :pep:`589`) is preferred over
@@ -647,8 +647,8 @@ Python 3.6 introduced support for variable type annotations, as
647647
specified in :pep:`526`.
648648

649649
If you need to support older versions of Python, type annotations can
650-
still be provided as “type comments”. These comments take the form #
651-
type: .
650+
still be provided as “type comments”. These comments take the form
651+
``# type:``.
652652

653653
.. code:: python
654654

0 commit comments

Comments
 (0)