Encode typing.Literal
equality semantics (to catch common x: str == MyLiteral
mistakes)
#7411
thejcannon
started this conversation in
Ideas
Replies: 1 comment
-
Thanks for the suggestion. This is the first time we've received such a request, and I've never personally seen such an error, so I'm not (yet) convinced this is a "common mistake". It's something I'd consider adding in the future if we receive additional signal from pyright users (e.g. in the form of upvotes on this topic). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given this program:
According to the typesigs, yeah sure anything can be compared and that'll return a boolean.
According to the semantics of
Literal
... we can probably assume that code is unreachable 😄 .And I think this is a common (enough) mistake to warrant special-casing.
Beta Was this translation helpful? Give feedback.
All reactions