diff options
author | MonadChains <monadchains@gmail.com> | 2022-12-24 20:07:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 20:07:14 (GMT) |
commit | f5b7b19bf10724d831285fb04e00f763838bd555 (patch) | |
tree | 495c1ec06aa41ce5c3d899a727242c6d7ac78d4c /Doc/howto | |
parent | e4b43ebb3afbd231a4e5630e7e358aa3093f8677 (diff) | |
download | cpython-f5b7b19bf10724d831285fb04e00f763838bd555.zip cpython-f5b7b19bf10724d831285fb04e00f763838bd555.tar.gz cpython-f5b7b19bf10724d831285fb04e00f763838bd555.tar.bz2 |
gh-99535: Add test for inheritance of annotations and update documentation (#99990)
Diffstat (limited to 'Doc/howto')
-rw-r--r-- | Doc/howto/annotations.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/howto/annotations.rst b/Doc/howto/annotations.rst index 2bc2f2d..4720690 100644 --- a/Doc/howto/annotations.rst +++ b/Doc/howto/annotations.rst @@ -57,6 +57,12 @@ Accessing The Annotations Dict Of An Object In Python 3.10 And Newer newer is to call :func:`getattr` with three arguments, for example ``getattr(o, '__annotations__', None)``. + Before Python 3.10, accessing ``__annotations__`` on a class that + defines no annotations but that has a parent class with + annotations would return the parent's ``__annotations__``. + In Python 3.10 and newer, the child class's annotations + will be an empty dict instead. + Accessing The Annotations Dict Of An Object In Python 3.9 And Older =================================================================== |