This issue tracker will soon become read-only and move to GitHub.
For a smoother transition, remember to log in and link your GitHub username to your profile.
For more information, see this post about the migration.

classification
Title: Duplicated sentence in for statement documentation
Type: Stage: patch review
Components: Documentation Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, michcio1234, python-dev, veky
Priority: normal Keywords: patch

Created on 2021-12-10 10:42 by michcio1234, last changed 2022-01-03 20:44 by veky.

Pull Requests
URL Status Linked Edit
PR 30025 open python-dev, 2021-12-10 11:05
Messages (4)
msg408189 - (view) Author: Michał D (michcio1234) * Date: 2021-12-10 10:42
In for statement description, there seem to be two sentences meant to mean the same:

> The suite is then executed once for each item provided by the iterator, in the order returned by the iterator. Each item in turn is assigned to the target list using the standard rules for assignments (see Assignment statements), and then the suite is executed.

(from https://docs.python.org/3/reference/compound_stmts.html#the-for-statement)

I believe only one of these sentences should be kept (probably the second one).

If I am wrong, and the current version is actually correct, then it is unclear - to me it sounds like the iterator is iterated through twice, and suite is executed twice for each item.
msg408193 - (view) Author: Vedran Čačić (veky) * Date: 2021-12-10 11:44
How about adding the words "More precisely," at the beginning of the second sentence?
msg409600 - (view) Author: Michał D (michcio1234) * Date: 2022-01-03 18:09
Please see the changes I suggested in my PR.
msg409619 - (view) Author: Vedran Čačić (veky) * Date: 2022-01-03 20:44
Yes, it's ok. The only slight problem is that is suggests that first item is somehow special, but later it is explained that in fact it is not. :-) I would say "_Each_ item ..." (instead of "First") and without the "this is repeated for every item..." at the end, but as I said, this is also fine.
History
Date User Action Args
2022-01-03 20:44:20vekysetmessages: + msg409619
2022-01-03 18:09:14michcio1234setmessages: + msg409600
2021-12-10 11:44:18vekysetnosy: + veky
messages: + msg408193
2021-12-10 11:05:16python-devsetkeywords: + patch
nosy: + python-dev

pull_requests: + pull_request28249
stage: patch review
2021-12-10 10:42:42michcio1234create