Created
December 14, 2021 01:00
-
-
Save akaptur/f798cac1cac52a1bbcd5c568effa8817 to your computer and use it in GitHub Desktop.
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
from dataclasses import dataclass | |
@dataclass | |
class A: | |
value: str | |
@dataclass | |
class B: | |
value: str | |
def my_func(obj: A) -> str: | |
return obj.value | |
my_func(B("hi")) # error: Argument 1 to "my_func" has incompatible type "B"; expected "A" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment