Skip to content

Commit e04b07d

Browse files
PEP 728: Fix some small mistakes (#4554)
Noticed some small issues while adapting this PEP to the typing spec.
1 parent ed1de2a commit e04b07d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

peps/pep-0728.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ extra items::
336336
name: str
337337

338338
def f(movie: Movie) -> None:
339-
del movie["name"] # Not OK. The value type of 'name' is 'Required[int]'
339+
del movie["name"] # Not OK. The value type of 'name' is 'Required[str]'
340340
del movie["year"] # OK. The value type of 'year' is 'NotRequired[int]'
341341

342342
Interaction with ``Unpack``
@@ -727,8 +727,8 @@ with signatures matching ``dict[str, VT]``
727727
reveal_type(not_required_num_dict.popitem()) # OK. Revealed type is 'tuple[str, int]'
728728

729729
def f(not_required_num_dict: IntDictWithNum, key: str):
730-
not_required_num_dict[key] = 42 # OK
731-
del not_required_num_dict[key] # OK
730+
not_required_num_dict[key] = 42 # OK
731+
del not_required_num_dict[key] # OK
732732

733733
:ref:`Notes on indexed accesses <pep728-type-narrowing>` from the previous section
734734
still apply.
@@ -742,7 +742,7 @@ because such dict can be a subtype of dict::
742742
def f(might_not_be_a_builtin_dict: dict[str, int]):
743743
int_dict: IntDict = might_not_be_a_builtin_dict # Not OK
744744

745-
not_a_builtin_dict: CustomDict = {"num": 1}
745+
not_a_builtin_dict = CustomDict({"num": 1})
746746
f(not_a_builtin_dict)
747747

748748
Runtime behavior

0 commit comments

Comments
 (0)