diff options
author | Patrick Reader <pxeger@protonmail.com> | 2020-09-16 04:58:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-16 04:58:32 (GMT) |
commit | 0705ec8a149e27023b0420ae0366d16255f6c9f7 (patch) | |
tree | cc477b4be6306f9b2007f4d2084440e7c965a643 /Doc | |
parent | 22415ad62555d79bd583b4a7d6a96006624a8277 (diff) | |
download | cpython-0705ec8a149e27023b0420ae0366d16255f6c9f7.zip cpython-0705ec8a149e27023b0420ae0366d16255f6c9f7.tar.gz cpython-0705ec8a149e27023b0420ae0366d16255f6c9f7.tar.bz2 |
bpo-41792: Add is_typeddict function to typing.py (GH-22254)
Closes issue41792.
Also closes https://github.com/python/typing/issues/751.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/typing.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 3125ae9..bfff81e 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1658,6 +1658,20 @@ Introspection helpers .. versionadded:: 3.8 +.. function:: is_typeddict(tp) + + Check if an annotation is a TypedDict class. + + For example:: + class Film(TypedDict): + title: str + year: int + + is_typeddict(Film) # => True + is_typeddict(Union[list, str]) # => False + + .. versionadded:: 3.10 + .. class:: ForwardRef A class used for internal typing representation of string forward references. |