Skip to content

Commit 78fb78b

Browse files
authored
Fix typos in generics.rst (#18110)
Found some minor typos in `generics.rst`
1 parent 7788c21 commit 78fb78b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/source/generics.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ example (Python 3.12 syntax):
146146
from typing import Mapping, Iterator
147147
148148
# This is a generic subclass of Mapping
149-
class MyMapp[KT, VT](Mapping[KT, VT]):
149+
class MyMap[KT, VT](Mapping[KT, VT]):
150150
def __getitem__(self, k: KT) -> VT: ...
151151
def __iter__(self) -> Iterator[KT]: ...
152152
def __len__(self) -> int: ...
@@ -641,7 +641,7 @@ infer the most flexible variance for each class type variable. Here
641641

642642
.. code-block:: python
643643
644-
class Box[T]: # this type is implilicitly covariant
644+
class Box[T]: # this type is implicitly covariant
645645
def __init__(self, content: T) -> None:
646646
self._content = content
647647
@@ -663,12 +663,12 @@ the attribute as ``Final``, the class could still be made covariant:
663663
664664
from typing import Final
665665
666-
class Box[T]: # this type is implilicitly covariant
666+
class Box[T]: # this type is implicitly covariant
667667
def __init__(self, content: T) -> None:
668668
self.content: Final = content
669669
670670
def get_content(self) -> T:
671-
return self._content
671+
return self.content
672672
673673
When using the legacy syntax, mypy assumes that all user-defined generics
674674
are invariant by default. To declare a given generic class as covariant or

0 commit comments

Comments
 (0)