Skip to content

Commit 8fd71d2

Browse files
authored
Allow unary + in Literal integers (#1550)
As discussed in https://discuss.python.org/t/signed-values-in-literal-type/39919
1 parent 606fef4 commit 8fd71d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/spec/literal.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ The following parameters are intentionally disallowed by design:
168168
``Literal[4j]`` that contain just a single complex number are also
169169
prohibited.
170170

171-
- The only exception to this rule is the unary ``-`` (minus) for ints: types
172-
like ``Literal[-5]`` are *accepted*.
171+
- The only exceptions to this rule are the unary ``-`` (minus) and unary ``+`` (plus) for ints: types
172+
like ``Literal[-5]`` and ``Literal[+1]`` are *accepted*.
173173

174174
- Tuples containing valid literal types like ``Literal[(1, "foo", "bar")]``.
175175
The user could always express this type as

0 commit comments

Comments
 (0)