From fa2dd3575c6207db76c1591cf95d90e04cffaf4a Mon Sep 17 00:00:00 2001 From: Daniel F Moisset Date: Mon, 25 Dec 2023 17:18:10 +0000 Subject: [PATCH] Allow unary + in Literal integers As discussed in https://discuss.python.org/t/signed-values-in-literal-type/39919 --- docs/spec/literal.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/spec/literal.rst b/docs/spec/literal.rst index 39d214f38..16919fd11 100644 --- a/docs/spec/literal.rst +++ b/docs/spec/literal.rst @@ -168,8 +168,8 @@ The following parameters are intentionally disallowed by design: ``Literal[4j]`` that contain just a single complex number are also prohibited. - - The only exception to this rule is the unary ``-`` (minus) for ints: types - like ``Literal[-5]`` are *accepted*. + - The only exceptions to this rule are the unary ``-`` (minus) and unary ``+`` (plus) for ints: types + like ``Literal[-5]`` and ``Literal[+1]`` are *accepted*. - Tuples containing valid literal types like ``Literal[(1, "foo", "bar")]``. The user could always express this type as