From 39c49f78fe8264e4f3a7280c7e363d56a6b93b22 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 18 Sep 2023 08:59:04 -0700 Subject: [PATCH] Add another limitation --- Doc/library/typing.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 2358452ce85e60..0380aa161e3b3e 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -2446,6 +2446,14 @@ types. .. versionadded:: 3.9 + .. note:: + + If ``from __future__ import annotations`` is used or if annotations + are given as strings, annotations are not evaluated when the + ``TypedDict`` is defined. Therefore, the runtime introspection that + ``__required_keys__`` and ``__optional_keys__`` rely on may not work + properly, and the values of the attributes may be incorrect. + See :pep:`589` for more examples and detailed rules of using ``TypedDict``. .. versionadded:: 3.8