Replies: 2 comments 3 replies
-
|
Linking #256 for related discussion |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think this may be a configuration issue. mypy-playground, pyright-playground One caveat is that they only raise the unreachable on the next line, not on the line that produces the See: python/mypy#15821 |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In
pandas, we have methods that can accept iterables of strings, but not a plain string. Fromuseful_types, there is theSequenceNotStrtype that is a sequence that doesn't include plain strings. But how can we do the same for iterables? I thought of doing something like this:Example:
This code will raise an exception as expected. If I uncomment the
reveal_type()line, the type is revealed asNoReturnorNeverby pyright and mypy, respectively. Butpyrightandmypydon't say that the line withv = 3 + 4is unreachable.Ideally, the type checker would show that
func("abc")is an invalid call. How do we accomplish that?Beta Was this translation helpful? Give feedback.
All reactions