From 4875d8ca992b9779ed949cee2e32589de100776d Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 6 Oct 2022 15:06:18 -0700 Subject: [PATCH 1/5] Add to README --- README.md | 4 +++- src/typing_extensions.py | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b974c1d5..6f2564d1 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,9 @@ This module currently contains the following: - Experimental features - - (Currently none) + - `override` (see PEP 698) + - The `default=` argument to `TypeVar`, `ParamSpec`, and `TypeVarTuple` (see PEP 697) + - The `infer_variance=` argument to `TypeVar` (see PEP 695) - In `typing` since Python 3.11 diff --git a/src/typing_extensions.py b/src/typing_extensions.py index acb0a94f..ef42417c 100644 --- a/src/typing_extensions.py +++ b/src/typing_extensions.py @@ -8,7 +8,6 @@ import typing -# Please keep __all__ alphabetized within each category. __all__ = [ # Super-special typing primitives. 'Any', From a8f69c51d7b0fb9edb0de807cabac9f9613de007 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 6 Oct 2022 15:11:20 -0700 Subject: [PATCH 2/5] Add notes --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 6f2564d1..baabeca8 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,11 @@ Certain objects were changed after they were added to `typing`, and `@typing_extensions.overload`. - `NamedTuple` was changed in Python 3.11 to allow for multiple inheritance with `typing.Generic`. +- Since Python 3.11, it has been possible to inherit from `Any` at + runtime. `typing_extensions.Any` also provides this capability. +- `TypeVar` gains two additional parameters, `default=` and `infer_variance=`, + in the draft PEPs 695 and 697, which are being considered for inclusion + in Python 3.12. There are a few types whose interface was modified between different versions of typing. For example, `typing.Sequence` was modified to From 688b9c8da8dd29afdd492ff468437b446d18fa9e Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 6 Oct 2022 15:16:56 -0700 Subject: [PATCH 3/5] more README --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index baabeca8..f60a1bd1 100644 --- a/README.md +++ b/README.md @@ -52,13 +52,13 @@ This module currently contains the following: - `reveal_type` - `Required` (see PEP 655) - `Self` (see PEP 673) - - `TypeVarTuple` (see PEP 646) + - `TypeVarTuple` (see PEP 646; the `typing_extensions` version supports the `default=` argument from PEP 697) - `Unpack` (see PEP 646) - In `typing` since Python 3.10 - `Concatenate` (see PEP 612) - - `ParamSpec` (see PEP 612) + - `ParamSpec` (see PEP 612; the `typing_extensions` version supports the `default=` argument from PEP 697) - `ParamSpecArgs` (see PEP 612) - `ParamSpecKwargs` (see PEP 612) - `TypeAlias` (see PEP 613) @@ -98,7 +98,6 @@ This module currently contains the following: - `Counter` - `DefaultDict` - `Deque` - - `NamedTuple` - `NewType` - `NoReturn` - `overload` @@ -107,6 +106,13 @@ This module currently contains the following: - `TYPE_CHECKING` - `get_type_hints` +- The following have always been present in `typing`, but the `typing_extensions` versions provide + additional features: + + - `Any` (supports inheritance since Python 3.11) + - `NamedTuple` (supports inheritance from `Generic` since Python 3.11) + - `TypeVar` (see PEPs 695 and 697) + # Other Notes and Limitations Certain objects were changed after they were added to `typing`, and From 4a5145d8993d56afcf5b7847c4e8933242ba7f53 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 6 Oct 2022 15:22:06 -0700 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Alex Waygood --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f60a1bd1..b11c8151 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ This module currently contains the following: - Experimental features - `override` (see PEP 698) - - The `default=` argument to `TypeVar`, `ParamSpec`, and `TypeVarTuple` (see PEP 697) + - The `default=` argument to `TypeVar`, `ParamSpec`, and `TypeVarTuple` (see PEP 696) - The `infer_variance=` argument to `TypeVar` (see PEP 695) - In `typing` since Python 3.11 @@ -52,13 +52,13 @@ This module currently contains the following: - `reveal_type` - `Required` (see PEP 655) - `Self` (see PEP 673) - - `TypeVarTuple` (see PEP 646; the `typing_extensions` version supports the `default=` argument from PEP 697) + - `TypeVarTuple` (see PEP 646; the `typing_extensions` version supports the `default=` argument from PEP 696) - `Unpack` (see PEP 646) - In `typing` since Python 3.10 - `Concatenate` (see PEP 612) - - `ParamSpec` (see PEP 612; the `typing_extensions` version supports the `default=` argument from PEP 697) + - `ParamSpec` (see PEP 612; the `typing_extensions` version supports the `default=` argument from PEP 696) - `ParamSpecArgs` (see PEP 612) - `ParamSpecKwargs` (see PEP 612) - `TypeAlias` (see PEP 613) @@ -111,7 +111,7 @@ This module currently contains the following: - `Any` (supports inheritance since Python 3.11) - `NamedTuple` (supports inheritance from `Generic` since Python 3.11) - - `TypeVar` (see PEPs 695 and 697) + - `TypeVar` (see PEPs 695 and 696) # Other Notes and Limitations @@ -136,7 +136,7 @@ Certain objects were changed after they were added to `typing`, and - Since Python 3.11, it has been possible to inherit from `Any` at runtime. `typing_extensions.Any` also provides this capability. - `TypeVar` gains two additional parameters, `default=` and `infer_variance=`, - in the draft PEPs 695 and 697, which are being considered for inclusion + in the draft PEPs 695 and 696, which are being considered for inclusion in Python 3.12. There are a few types whose interface was modified between different From 794460ca7d9ca1a7515e8222018daa09f7ce5ea2 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 6 Oct 2022 15:24:07 -0700 Subject: [PATCH 5/5] Update README.md Co-authored-by: Alex Waygood --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b11c8151..bc4a7791 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ This module currently contains the following: additional features: - `Any` (supports inheritance since Python 3.11) - - `NamedTuple` (supports inheritance from `Generic` since Python 3.11) + - `NamedTuple` (supports multiple inheritance with `Generic` since Python 3.11) - `TypeVar` (see PEPs 695 and 696) # Other Notes and Limitations