classification
Title: Docs: TypedDict is now of type function instead of class
Type: Stage:
Components: Versions: Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Anthony Sottile, gaborjbernat, serhiy.storchaka, ssbarnea
Priority: normal Keywords:

Created on 2020-10-08 06:26 by gaborjbernat, last changed 2020-10-15 16:13 by ssbarnea.

Messages (4)
msg378212 - (view) Author: Bernat Gabor (gaborjbernat) * Date: 2020-10-08 06:26
❯ py -3.8 -c 'from typing import TypedDict; print(type(TypedDict))'
<class 'typing._TypedDictMeta'>

❯ py -3.9 -c 'from typing import TypedDict; print(type(TypedDict))'
<class 'function'>

Python 3.9 changed the type of the TypedDict but the documentation still says it's a class - see https://docs.python.org/3.9/library/typing.html#typing.TypedDict. I must also say I'm suprised you can inherit from a function, but we should update the documentation to reflect that the type of the element in question is no longer class.
msg378213 - (view) Author: Anthony Sottile (Anthony Sottile) * Date: 2020-10-08 06:32
Seems to be due to https://bugs.python.org/issue40187
msg378216 - (view) Author: Bernat Gabor (gaborjbernat) * Date: 2020-10-08 06:41
Static checkers/linters (see e.g. https://github.com/PyCQA/pylint/issues/3884) are caught of guard by being able to inherit from functions. They'll need to adapt, but let's update the documentation to reflect this.
msg378217 - (view) Author: Bernat Gabor (gaborjbernat) * Date: 2020-10-08 06:44
This seem to apply to typing.NamedTuple too.
History
Date User Action Args
2020-10-15 16:13:57ssbarneasetnosy: + ssbarnea
2020-10-08 06:44:25gaborjbernatsetmessages: + msg378217
2020-10-08 06:41:07gaborjbernatsetmessages: + msg378216
2020-10-08 06:32:59Anthony Sottilesetnosy: + serhiy.storchaka, Anthony Sottile
messages: + msg378213
2020-10-08 06:26:46gaborjbernatcreate