Skip to content

Commit

Permalink
Added language to reflect the intended behavior for triple-quoted typ…
Browse files Browse the repository at this point in the history
…e annotation expressions.
  • Loading branch information
erictraut committed Jan 13, 2024
1 parent 8fd71d2 commit 2553063
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/spec/annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down

0 comments on commit 2553063

Please sign in to comment.