From 506636cceaf85b50a459d376dce195f6fb3cef37 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Sat, 11 Mar 2023 14:37:39 +0000 Subject: [PATCH 1/5] Remove support for tuples as ParamSpec defaults --- pep-0696.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pep-0696.rst b/pep-0696.rst index 564449904d9..6777f31e4cf 100644 --- a/pep-0696.rst +++ b/pep-0696.rst @@ -143,7 +143,7 @@ future, this might be possible (see `Interaction with PEP '''''''''''''''''''''' ``ParamSpec`` defaults are defined using the same syntax as -``TypeVar`` \ s but use a ``list`` or ``tuple`` of types or an ellipsis +``TypeVar`` \ s but use a ``list`` of types or an ellipsis literal "``...``" or another in-scope ``ParamSpec`` (see :ref:`696-scoping-rules`). .. code-block:: py @@ -152,9 +152,9 @@ literal "``...``" or another in-scope ``ParamSpec`` (see :ref:`696-scoping-rules class Foo(Generic[DefaultP]): ... - reveal_type(Foo) # type is type[Foo[DefaultP = (str, int)]] - reveal_type(Foo()) # type is Foo[(str, int)] - reveal_type(Foo[(bool, bool)]()) # type is Foo[(bool, bool)] + reveal_type(Foo) # type is type[Foo[DefaultP = [str, int]]] + reveal_type(Foo()) # type is Foo[[str, int]] + reveal_type(Foo[[bool, bool]]()) # type is Foo[[bool, bool]] ``TypeVarTuple`` Defaults ''''''''''''''''''''''''' @@ -418,14 +418,14 @@ using the "=" operator inside of the square brackets like so: class Foo[T = str]: ... # ParamSpecs - class Baz[**P = (int, str)]: ... + class Baz[**P = [int, str]]: ... # TypeVarTuples class Qux[*Ts = *tuple[int, bool]]: ... # TypeAliases type Foo[T, U = str] = Bar[T, U] - type Baz[**P = (int, str)] = Spam[**P] + type Baz[**P = [int, str]] = Spam[**P] type Qux[*Ts = *tuple[str]] = Ham[*Ts] type Rab[U, T = str] = Bar[T, U] From 08a5ed4a815610fb043323a7a4d191b9b638065e Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Sat, 11 Mar 2023 23:47:10 +0000 Subject: [PATCH 2/5] Update discussions to and post history --- pep-0696.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pep-0696.rst b/pep-0696.rst index 6777f31e4cf..30a09db97f6 100644 --- a/pep-0696.rst +++ b/pep-0696.rst @@ -2,13 +2,15 @@ PEP: 696 Title: Type defaults for TypeVarLikes Author: James Hilton-Balfe Sponsor: Jelle Zijlstra -Discussions-To: typing-sig@python.org +Discussions-To: https://mail.python.org/archives/list/typing-sig@python.org/thread/7VWBZWXTCX6RAJO6GG67BAXUPFZ24NTC Status: Draft Type: Standards Track Topic: Typing Content-Type: text/x-rst Created: 14-Jul-2022 Python-Version: 3.12 +Post-History: `22-Mar-2022 `__, + `8-Jan-2023 `__, Abstract -------- From 0db657f899104023e26c599e1abc43686a8d0f1e Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Sat, 11 Mar 2023 23:47:51 +0000 Subject: [PATCH 3/5] Add link to reference cpython impl --- pep-0696.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pep-0696.rst b/pep-0696.rst index 30a09db97f6..92c8ac68631 100644 --- a/pep-0696.rst +++ b/pep-0696.rst @@ -401,6 +401,9 @@ The following changes would be required to both ``GenericAlias``\ es: - ideally, logic to determine if subscription (like ``Generic[T, DefaultT]``) would be valid. +A reference implementation of the runtime changes can be found at +https://github.com/Gobot1234/cpython/tree/pep-696 + A reference implementation of the type checker can be found at https://github.com/Gobot1234/mypy/tree/TypeVar-defaults From c3befd9703e4accd2eaf7547bc79c2b9d859a02f Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Sat, 11 Mar 2023 23:53:52 +0000 Subject: [PATCH 4/5] Try fixing lint --- pep-0696.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0696.rst b/pep-0696.rst index 92c8ac68631..bb7a54508dc 100644 --- a/pep-0696.rst +++ b/pep-0696.rst @@ -9,8 +9,8 @@ Topic: Typing Content-Type: text/x-rst Created: 14-Jul-2022 Python-Version: 3.12 -Post-History: `22-Mar-2022 `__, - `8-Jan-2023 `__, +Post-History: `22-Mar-2022 `__, + `8-Jan-2023 `__, Abstract -------- From d334dd348305ba9828096d22f92500a8b8a11d22 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Sun, 12 Mar 2023 00:49:42 +0000 Subject: [PATCH 5/5] Try fixing the lint for the second time --- pep-0696.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pep-0696.rst b/pep-0696.rst index bb7a54508dc..1759b7fee5b 100644 --- a/pep-0696.rst +++ b/pep-0696.rst @@ -10,7 +10,7 @@ Content-Type: text/x-rst Created: 14-Jul-2022 Python-Version: 3.12 Post-History: `22-Mar-2022 `__, - `8-Jan-2023 `__, + `08-Jan-2023 `__, Abstract --------