diff options
author | Zac Hatfield-Dodds <Zac-HD@users.noreply.github.com> | 2019-11-24 10:48:48 (GMT) |
---|---|---|
committer | Ivan Levkivskyi <levkivskyi@gmail.com> | 2019-11-24 10:48:48 (GMT) |
commit | 665ad3dfa9993b9a4000b097ddead4e292590e8c (patch) | |
tree | 886741ee4ffc36e769575e51b5e576d1f8e22b02 /Misc | |
parent | 041d8b48a2e59fa642b2c5124d78086baf74e339 (diff) | |
download | cpython-665ad3dfa9993b9a4000b097ddead4e292590e8c.zip cpython-665ad3dfa9993b9a4000b097ddead4e292590e8c.tar.gz cpython-665ad3dfa9993b9a4000b097ddead4e292590e8c.tar.bz2 |
Better runtime TypedDict (GH-17214)
This patch enables downstream projects inspecting a TypedDict subclass at runtime to tell which keys are optional.
This is essential for generating test data with Hypothesis or validating inputs with typeguard or pydantic.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-11-18-17-08-23.bpo-38834.abcdef.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2019-11-18-17-08-23.bpo-38834.abcdef.rst b/Misc/NEWS.d/next/Library/2019-11-18-17-08-23.bpo-38834.abcdef.rst new file mode 100644 index 0000000..af108b1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-18-17-08-23.bpo-38834.abcdef.rst @@ -0,0 +1,3 @@ +:class:`typing.TypedDict` subclasses now track which keys are optional using +the ``__required_keys__`` and ``__optional_keys__`` attributes, to enable +runtime validation by downstream projects. Patch by Zac Hatfield-Dodds. |