Skip to content

Commit

Permalink
Docs: fix TypeError in code example (#1413)
Browse files Browse the repository at this point in the history
Fix TypeError of 'class MyProto(Protocol)'

TypeError: Too few arguments for typing.Mapping; actual 1, expected 2
  • Loading branch information
ozgurturkiye authored Jun 18, 2023
1 parent e38affe commit 3811d8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Maybe::

class MyProto(Protocol):
def foo(self) -> list[int]: ...
def bar(self) -> Mapping[str]: ...
def bar(self) -> Mapping[str, str]: ...

Avoid union return types, since they require ``isinstance()`` checks.
Use ``Any`` or ``X | Any`` if necessary.
Expand Down

0 comments on commit 3811d8c

Please sign in to comment.