PEP 696: Add note about lazy eval with PEP 695 (#3145)

This commit is contained in:
James Hilton-Balfe 2023-05-28 23:47:52 +01:00 committed by GitHub
parent 15f8e2810b
commit b9bbe0e4d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -413,9 +413,9 @@ Pyright currently supports this functionality.
Interaction with PEP 695
------------------------
If this PEP is accepted, the syntax proposed in :pep:`695` will be
extended to introduce a way to specify defaults for type parameters
using the "=" operator inside of the square brackets like so:
The syntax proposed in :pep:`695` will be extended to introduce a way
to specify defaults for type parameters using the "=" operator inside
of the square brackets like so:
.. code-block:: py
@ -434,6 +434,10 @@ using the "=" operator inside of the square brackets like so:
type Qux[*Ts = *tuple[str]] = Ham[*Ts]
type Rab[U, T = str] = Bar[T, U]
:ref:`Similarly to the bound for a type parameter <695-scoping-behavior>`,
defaults should be lazily evaluated, with the same scoping rules to
avoid the unnecessary usage of quotes around them.
This functionality was included in the initial draft of :pep:`695` but
was removed due to scope creep.