From 6f030ad3b1491d456771f71063173f95b06a59b9 Mon Sep 17 00:00:00 2001 From: Rebecca Chen Date: Wed, 14 Aug 2024 19:50:11 -0700 Subject: [PATCH] Reword syntax section. --- docs/spec/distributing.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/spec/distributing.rst b/docs/spec/distributing.rst index 17b8c00f..886a95f9 100644 --- a/docs/spec/distributing.rst +++ b/docs/spec/distributing.rst @@ -47,11 +47,12 @@ by stub files is independent from the Python versions supported by the implementation, and from the Python version the type checker runs under (if any). -Type checkers should treat stubs as if ``from __future__ import annotations`` is -enabled. In particular, forward references do not need to be quoted, and syntax -from newer versions than otherwise supported may be used in annotation -expressions. For example, the pipe union syntax (``X | Y``) introduced in Python -3.10 may be used even before Python 3.9 reaches end-of-life. +Type checkers should evaluate all annotation expressions as if they are quoted. +Consequently, forward references do not need to be quoted, and syntax from newer +versions than otherwise supported may be used in annotations. For example, the +pipe union syntax (``X | Y``) introduced in Python 3.10 may be used even before +Python 3.9 reaches end-of-life. Outside of annotations, type checkers may but +are not required to support type system features that use newer syntax. .. _stub-file-supported-constructs: @@ -61,6 +62,7 @@ Supported Constructs Type checkers should fully support these constructs: * All features from the ``typing`` module of the latest released Python version + that use :ref:`supported syntax ` * Comments, including type declaration (``# type: X``) and error suppression (``# type: ignore``) comments * Import statements, including the standard :ref:`import-conventions` and cyclic