From 2553063cb7b6724ce9237e1b9295d0fa39a08d6f Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Sat, 13 Jan 2024 11:56:20 -0800 Subject: [PATCH] Added language to reflect the intended behavior for triple-quoted type annotation expressions. --- docs/spec/annotations.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/spec/annotations.rst b/docs/spec/annotations.rst index a3b8ea7df..e4c5c7772 100644 --- a/docs/spec/annotations.rst +++ b/docs/spec/annotations.rst @@ -114,6 +114,16 @@ be evaluated. Moreover, the expression should be parseable as a valid type hint, i.e., it is constrained by the rules from the section on :ref:`valid-types`. +If a triple quote is used, the string should be parsed as though it is +implicitly surrounded by parentheses. This allows newline characters to be +used within the string literal. + + value: """ + int | + str | + list[Any] + """ + It is allowable to use string literals as *part* of a type hint, for example::