classification
Title: [typing] TypedDict's 'total' argument is undocumented
Type: Stage: resolved
Components: Documentation Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Ananthakrishnan, brett.cannon, docs@python, gvanrossum, levkivskyi, miss-islington
Priority: normal Keywords: easy, patch

Created on 2020-02-06 20:08 by brett.cannon, last changed 2020-02-19 14:57 by gvanrossum. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18554 merged Ananthakrishnan, 2020-02-18 18:21
PR 18556 merged miss-islington, 2020-02-19 05:06
Messages (10)
msg361503 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-02-06 20:07
The docs mention __total__, but there's no mention of how to actually set that attribute, nor what it actually represents.

P.S. https://github.com/python/cpython/blob/master/Lib/typing.py#L16 says TypedDict "may be added soon"; I think that's outdated. ;)
msg362228 - (view) Author: Ananthakrishnan (Ananthakrishnan) * Date: 2020-02-18 17:05
https://stackoverflow.com/questions/58427394/what-is-the-meaning-of-total-dunder-attribute-in-python-3

questions about this.
msg362229 - (view) Author: Ananthakrishnan (Ananthakrishnan) * Date: 2020-02-18 17:49
It will be usefull if we document _total_ argument also.
msg362231 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-02-18 18:17
There's no __total__ argument, but there is a __total__ attribute. There are also (new in 3.9) __required_keys__ and __total_keys__ attributes.

Are you interested in submitting a PR with the needed doc changes?
msg362232 - (view) Author: Ananthakrishnan (Ananthakrishnan) * Date: 2020-02-18 18:19
yes,I'm interested.
msg362247 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-02-19 04:33
New changeset ab6423fe2de0ed5f8a0dc86a9c7070229326b0f0 by ananthan-123 in branch 'master':
bpo-39572: Document ’total’ flag of TypedDict (GH-18554)
https://github.com/python/cpython/commit/ab6423fe2de0ed5f8a0dc86a9c7070229326b0f0
msg362251 - (view) Author: miss-islington (miss-islington) Date: 2020-02-19 05:24
New changeset 44c690112d96a81fe02433de7900a4f8f9457012 by Miss Islington (bot) in branch '3.8':
bpo-39572: Document ’total’ flag of TypedDict (GH-18554)
https://github.com/python/cpython/commit/44c690112d96a81fe02433de7900a4f8f9457012
msg362252 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-02-19 05:28
Separately, would you also be interested in writing docs for the `__total__` class attribute of TypedDict subclasses (3.8 and 3.9) and for the `__required_keys__` and `__total_keys__` attributes (only in 3.9)? (Sorry, there's no document you can crib these from. :-)
msg362262 - (view) Author: Ananthakrishnan (Ananthakrishnan) * Date: 2020-02-19 10:30
yes,I'm interested in writing docs for the `__required_keys__` and `__total_keys__` attributes.
msg362276 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-02-19 14:57
Go for it. Use the same bug number.

On Wed, Feb 19, 2020 at 02:30 Ananthakrishnan <report@bugs.python.org>
wrote:

>
> Ananthakrishnan <ananthakrishnan15.2001@gmail.com> added the comment:
>
> yes,I'm interested in writing docs for the `__required_keys__` and
> `__total_keys__` attributes.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue39572>
> _______________________________________
>
-- 
--Guido (mobile)
History
Date User Action Args
2020-02-19 14:57:29gvanrossumsetmessages: + msg362276
2020-02-19 10:30:36Ananthakrishnansetmessages: + msg362262
2020-02-19 05:28:20gvanrossumsetstatus: open -> closed
resolution: fixed
messages: + msg362252

stage: patch review -> resolved
2020-02-19 05:24:57miss-islingtonsetnosy: + miss-islington
messages: + msg362251
2020-02-19 05:06:05miss-islingtonsetpull_requests: + pull_request17936
2020-02-19 04:33:13gvanrossumsetmessages: + msg362247
2020-02-18 18:21:44Ananthakrishnansetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request17935
2020-02-18 18:19:10Ananthakrishnansetmessages: + msg362232
2020-02-18 18:17:37gvanrossumsetmessages: + msg362231
2020-02-18 17:49:03Ananthakrishnansetmessages: + msg362229
2020-02-18 17:31:56gvanrossumsetkeywords: + easy
2020-02-18 17:05:42Ananthakrishnansetnosy: + Ananthakrishnan
messages: + msg362228
2020-02-06 20:08:00brett.cannoncreate