You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mypy reports error for the above code, but x is actually an instance of Literal["a", "b"], because all values other than "a" or "b" raises ValueError.
Pyright, one of type checkers, can infer this code has no problem.
fromtypingimportLiteraldest: Literal["tata", "tutu"]
forsrcin"tata", "tutu":
dest=src# error: Incompatible types in assignment (expression has type "str", variable has type "Literal['http', 'https']")
Don't mind me, I opened a specific issue for my example as it's not exactly the same thing (#12446).
Activity
JulienPalard commentedon Mar 23, 2022
I think I just found a closely related example:
Don't mind me, I opened a specific issue for my example as it's not exactly the same thing (#12446).