Created
May 12, 2018 09:36
-
-
Save kkismd/50c95f0b260f654407ab6e33da693f2d to your computer and use it in GitHub Desktop.
mypy why
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dog(): | |
def __init__(self, name: str) -> None: | |
self.name: str = name | |
def bark(self) -> str: | |
return "Bow-wow (" + self.name + ")" | |
def test(): | |
# No mypy error, but causes Rutime error at next line!!! | |
dog = Dog(123) | |
dog.bark() | |
test() | |
# mypy: error: Argument 1 to "Dog" has incompatible type "int"; expected "str" | |
dog = Dog(123) | |
dog.bark() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not error in line 10?