From e8bdea875b75328bf5cd4f5be6c1062411f5aebb Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 16 Aug 2025 08:07:10 -0700 Subject: [PATCH 1/2] PEP 728: Minor fixes Noticed some small issues while adapting this PEP to the typing spec. --- peps/pep-0728.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/peps/pep-0728.rst b/peps/pep-0728.rst index b89f8b79824..7d9fdc276f4 100644 --- a/peps/pep-0728.rst +++ b/peps/pep-0728.rst @@ -726,8 +726,8 @@ with signatures matching ``dict[str, VT]`` reveal_type(not_required_num_dict.popitem()) # OK. Revealed type is 'tuple[str, int]' def f(not_required_num_dict: IntDictWithNum, key: str): - not_required_num_dict[key] = 42 # OK - del not_required_num_dict[key] # OK + not_required_num_dict[key] = 42 # OK + del not_required_num_dict[key] # OK :ref:`Notes on indexed accesses ` from the previous section still apply. @@ -741,7 +741,7 @@ because such dict can be a subtype of dict:: def f(might_not_be_a_builtin_dict: dict[str, int]): int_dict: IntDict = might_not_be_a_builtin_dict # Not OK - not_a_builtin_dict: CustomDict = {"num": 1} + not_a_builtin_dict = CustomDict({"num": 1}) f(not_a_builtin_dict) Runtime behavior From 1095c6582c9f4e9e55e911cb0d112542222bbff1 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 18 Aug 2025 10:29:31 -0700 Subject: [PATCH 2/2] one more --- peps/pep-0728.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peps/pep-0728.rst b/peps/pep-0728.rst index 7d9fdc276f4..fcc019c94d9 100644 --- a/peps/pep-0728.rst +++ b/peps/pep-0728.rst @@ -335,7 +335,7 @@ extra items:: name: str def f(movie: Movie) -> None: - del movie["name"] # Not OK. The value type of 'name' is 'Required[int]' + del movie["name"] # Not OK. The value type of 'name' is 'Required[str]' del movie["year"] # OK. The value type of 'year' is 'NotRequired[int]' Interaction with ``Unpack``