Closed JelleZijlstra closed 7 months ago
Yup. The symmetry argument makes sense.
This is reasonable, and pyright, pyre, pytype, mypy (following Jelle's PR) all support it.
Actually, pyright will need to be modified. It honors the current spec. It's easy to change. Slightly more involved if we decide that we want to support an arbitrary number of unary operators (Literal[---++++-----+++1]
), but still pretty straightforward.
Huh, so it is, sorry about that. I've had https://pyright-play.net/ lag for me once or twice before, maybe that's what happened :-/
Then I suggest that pyright choses to only implement a single +
or -
. After all that's what was asked for.
OK, let's go with that. The outcome is that Literal[+1]
is supported, and we leave the behavior of Literal[+-+-+-1]
unspecified.
This is to ask the Typing Council to approve python/typing#1550, specifying that
Literal[+1]
should be allowed. See also https://discuss.python.org/t/signed-values-in-literal-type/39919, cc @dmoisset.(I'm opening this issue here on this tracker so that we have a clear record of the decision, and people following this repo won't miss it.)