[issue46066] Docs: TypedDict alternative definition syntax with keyword args is confusing

97littleleaf11 report at bugs.python.org
Mon Dec 13 10:36:57 EST 2021


New submission from 97littleleaf11 <97littleleaf11 at gmail.com>:

According to the docs: https://docs.python.org/3/library/typing.html?#typing.TypedDict, there are two additional equivalent syntax for TypedDict definition.

Point2D = TypedDict('Point2D', x=int, y=int, label=str)
Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})

However, the former one is quite confusing since we have the `total` keyword arg for TypedDict. In addition, PEP589(https://www.python.org/dev/peps/pep-0589/#id19) doesn't have this.

I think we could discard the definition syntax using keyword args in the doc.

----------
assignee: docs at python
components: Documentation
messages: 408458
nosy: 97littleleaf11, docs at python
priority: normal
severity: normal
status: open
title: Docs: TypedDict alternative definition syntax with keyword args is confusing
versions: Python 3.10, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46066>
_______________________________________


More information about the Python-bugs-list mailing list