Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revisited mypy error messages in casts.rst
Signed-off-by: Oleg Höfling <[email protected]>
  • Loading branch information
hoefling committed Oct 13, 2019
commit 5b23ebde44e88df60fa2ebc57686f66edee1b6be
4 changes: 2 additions & 2 deletions docs/source/casts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ quite understand what is going on.
.. code-block:: python

def foo(o: object) -> None:
print(o + 5) # Error: can't add 'object' and 'int'
print(o + 5) # error: Unsupported operand types for + ("object" and "int")
assert isinstance(o, int)
print(o + 5) # OK: type of 'o' is 'int' here

Expand All @@ -44,6 +44,6 @@ any operations on the result. For example:
from typing import cast, Any

x = 1
x.whatever() # Type check error
x.whatever() # error: "int" has no attribute "whatever"
y = cast(Any, x)
y.whatever() # Type check OK (runtime error)