This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Update Index for set, dict, and generator 'comprehensions'
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.10, Python 3.9, Python 3.8
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: DahlitzFlorian, akuchling, docs@python, louielu, miss-islington, r.david.murray, terry.reedy
Priority: normal Keywords: easy, patch

Created on 2017-04-04 18:01 by terry.reedy, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 995 closed louielu, 2017-04-05 05:08
PR 20272 merged DahlitzFlorian, 2020-05-20 21:18
PR 22836 merged miss-islington, 2020-10-20 21:27
PR 22837 merged miss-islington, 2020-10-20 21:27
Messages (10)
msg291129 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-04-04 18:01
The index currently has


with *list* linked to 6.2.5 List displays.  I suggest:

1. Link *comprehensions* to 6.2.4. Displays for lists, sets and dictionaries
2. Add subentries *set*, *dict*, and *generator* linked to
2a. 6.2.6. Set displays
2b. 6.2.7. Dictionary displays
2c. 6.2.8. Generator expressions

We don't *call* generator expressions 'generator comprehensions', but that is what they are syntactically and one looking for 'comprehensions' should be able to find them there.

There is already

*list comprehensions*

with 'list' and 'list comprehensions' linked to glossary entries, while 'list, comprehensions' links to the same section as 'comprehensions, list'.  

3. Add 'set/dictionary, comprehensions' sub-entries linked like 'list, com
4. Add Glossary entries and links like 'list comprehensions'
msg291132 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-04-04 18:33
See #29983 for expanding the title of the 'atoms' section containing subsections on comprehensions.
msg296580 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-06-21 20:18
On the PR Berker wrote:

   I'm wondering if we should still advertise the use of set([...]). We replaced all instances of it with set literals in the stdlib.

set([...]) is part of the language, and the python documentation is also a specification of the language, so I think the reference *must* stay.
msg369475 - (view) Author: Florian Dahlitz (DahlitzFlorian) * Date: 2020-05-20 20:13
I would like to work on this issue if it is still open.
msg369489 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-21 02:48
The issue is still open. The basic idea is to treat list, set, and dict in parallel fashions in the docs, mostly copying what is done with lists for the other two.  In my original post, the title and items 1 to 3 are about index entries in Reference chapter 6, Expressions (reference/expressions.rst).  I tacked on item 4 about adding entries to the Glossary (glossary.rst).  These could easily be and for easier review should be separate PRs.

The original PR, opened relatively soon after githup went public, was reviewed by 5 different committers, which is an unusually large number.
It included both indexing and glossary changes, and added changes to the Library chapter on built-in types (stdtypes.rst).  The last was the most controversial and definitely needed to be a followup PR.

In June 2017, after much discussion and revision, Louie Lu switched his github account from 'louisom' to 'louielu' and ceased working on this.  Some later, louisom/cpython was deleted and the PR closed for inactivity.

> We don't *call* generator expressions 'generator comprehensions',

A subsequent pydev discussion approved of 'generator comprehension' and I believe some doc changes followed*.  So I expect that the previous PR is somewhat obsolete.  Pick either indexing Expressions or new Glossary entries and see what change you think is still needed and consider any discussion of that change on PR 995. Note: I am not sure that I reviewed (and approved) the index part of the patch, as I likely focused on other parts.   You can propose (and justify) changes here before making a PR.

* Any changes may or may not have been backported to 3.7, so it may or may not be possible to easily backport any new changes (with the robot).
msg369490 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-21 02:55
I wrote the above before your PR was listed here.  I will review it a piece at a time.
msg369501 - (view) Author: Florian Dahlitz (DahlitzFlorian) * Date: 2020-05-21 07:17
I guess it would have been good if I waited submitting a PR until you replied to my message. This way, I would have known that two separate PRs would be better suited here - sorry for that.

Nevertheless, I read the discussions here and in PR #995 and I'm pretty sure that the proposed changes do fit into the documentation (pretty similar to those from PR #995).

I'm eager to hear your or other people's feedback - thanks!
msg379165 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2020-10-20 21:27
New changeset 2d55aa9e37c9c84f4f6a8135d0326da0bcd8f38b by Florian Dahlitz in branch 'master':
bpo-29981: Add examples and update index for set, dict, and generator comprehensions'(GH-20272)
msg379554 - (view) Author: miss-islington (miss-islington) Date: 2020-10-25 02:53
New changeset 60bef61f717dde915058b03159b2c2e97d765858 by Miss Skeleton (bot) in branch '3.8':
bpo-29981: Add examples and update index for set, dict, and generator comprehensions'(GH-20272)
msg379555 - (view) Author: miss-islington (miss-islington) Date: 2020-10-25 02:53
New changeset 2cccc29eaf20694006c03af0f4740abdf8ae5579 by Miss Skeleton (bot) in branch '3.9':
bpo-29981: Add examples and update index for set, dict, and generator comprehensions'(GH-20272)
Date User Action Args
2022-04-11 14:58:44adminsetgithub: 74167
2020-10-25 02:57:18methanesetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: - Python 3.7
2020-10-25 02:53:44miss-islingtonsetmessages: + msg379555
2020-10-25 02:53:24miss-islingtonsetmessages: + msg379554
2020-10-20 21:27:33miss-islingtonsetpull_requests: + pull_request21791
2020-10-20 21:27:25miss-islingtonsetkeywords: + patch
nosy: + miss-islington

pull_requests: + pull_request21790
stage: needs patch -> patch review
2020-10-20 21:27:18akuchlingsetnosy: + akuchling
messages: + msg379165
2020-05-21 07:17:44DahlitzFloriansetmessages: + msg369501
2020-05-21 02:55:15terry.reedysetmessages: + msg369490
2020-05-21 02:48:26terry.reedysetkeywords: - patch

stage: patch review -> needs patch
messages: + msg369489
versions: + Python 3.8, Python 3.9, Python 3.10, - Python 3.6
2020-05-20 21:18:35DahlitzFloriansetkeywords: + patch
pull_requests: + pull_request19552
2020-05-20 20:13:34DahlitzFloriansetnosy: + DahlitzFlorian
messages: + msg369475
2017-06-21 20:18:14r.david.murraysetnosy: + r.david.murray
messages: + msg296580
2017-06-07 18:07:16Mariattasetstage: needs patch -> patch review
2017-04-05 05:08:07louielusetpull_requests: + pull_request1170
2017-04-05 04:35:34louielusetnosy: + louielu
2017-04-04 18:33:04terry.reedysetmessages: + msg291132
title: Update Index set, dict, and generator 'comprehensions' -> Update Index for set, dict, and generator 'comprehensions'
2017-04-04 18:01:11terry.reedycreate