-
Notifications
You must be signed in to change notification settings - Fork 263
Open
Labels
topic: documentationDocumentation-related issues and PRsDocumentation-related issues and PRs
Description
Hi.
I'm just curious why passing arguments to TypeDict
is strictly constrained. I tried some variants including positional arguments style and failed. It's not reflected in docs or function signature (ctrl + p
in Pycharm)
https://docs.python.org/3/library/typing.html#typing.TypedDict
In [1]: from typing import TypedDict
In [2]:
...: ProfileText = TypedDict(name='ProfileText', fields={'name': str, 'non variable key': str}, total=False) # Error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-7d3b7c9254f3> in <module>
----> 1 ProfileText = TypedDict(name='ProfileText', fields={'name': str, 'non variable key': str}, total=False) # Error
TypeError: _typeddict_new() missing 1 required positional argument: 'typename'
In [3]:
...: ProfileText = TypedDict('ProfileText', {'name': str, 'non variable key': str}, total=False) # Error
In [4]:
...: ProfileText = TypedDict('ProfileText', {'name': str, 'non variable key': str}, False) # Error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-b3b55e028c98> in <module>
----> 1 ProfileText = TypedDict('ProfileText', {'name': str, 'non variable key': str}, False) # Error
TypeError: _typeddict_new() takes from 2 to 3 positional arguments but 4 were given
In [5]:
tony
Metadata
Metadata
Assignees
Labels
topic: documentationDocumentation-related issues and PRsDocumentation-related issues and PRs