Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated sentence in for statement documentation #90191

Closed
michcio1234 mannequin opened this issue Dec 10, 2021 · 5 comments
Closed

Duplicated sentence in for statement documentation #90191

michcio1234 mannequin opened this issue Dec 10, 2021 · 5 comments
Labels
3.10 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@michcio1234
Copy link
Mannequin

michcio1234 mannequin commented Dec 10, 2021

BPO 46033
Nosy @terryjreedy, @vedgar, @michcio1234
PRs
  • bpo-46033: Clarify for-statement execution #30025
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-04-03.00:54:41.265>
    created_at = <Date 2021-12-10.10:42:42.112>
    labels = ['type-feature', '3.10', 'docs']
    title = 'Duplicated sentence in for statement documentation'
    updated_at = <Date 2022-04-03.00:54:41.264>
    user = 'https://github.com/michcio1234'

    bugs.python.org fields:

    activity = <Date 2022-04-03.00:54:41.264>
    actor = 'terry.reedy'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2022-04-03.00:54:41.265>
    closer = 'terry.reedy'
    components = ['Documentation']
    creation = <Date 2021-12-10.10:42:42.112>
    creator = 'michcio1234'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46033
    keywords = ['patch']
    message_count = 5.0
    messages = ['408189', '408193', '409600', '409619', '416608']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'docs@python', 'python-dev', 'veky', 'michcio1234']
    pr_nums = ['30025']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue46033'
    versions = ['Python 3.10']

    @michcio1234
    Copy link
    Mannequin Author

    michcio1234 mannequin commented Dec 10, 2021

    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.

    @michcio1234 michcio1234 mannequin added the 3.10 only security fixes label Dec 10, 2021
    @michcio1234 michcio1234 mannequin assigned docspython Dec 10, 2021
    @michcio1234 michcio1234 mannequin added docs Documentation in the Doc dir 3.10 only security fixes labels Dec 10, 2021
    @michcio1234 michcio1234 mannequin assigned docspython Dec 10, 2021
    @michcio1234 michcio1234 mannequin added the docs Documentation in the Doc dir label Dec 10, 2021
    @vedgar
    Copy link
    Mannequin

    vedgar mannequin commented Dec 10, 2021

    How about adding the words "More precisely," at the beginning of the second sentence?

    @michcio1234
    Copy link
    Mannequin Author

    michcio1234 mannequin commented Jan 3, 2022

    Please see the changes I suggested in my PR.

    @vedgar
    Copy link
    Mannequin

    vedgar mannequin commented Jan 3, 2022

    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.

    @terryjreedy
    Copy link
    Member

    New changeset 281f980 by Michał D in branch 'main':
    bpo-46033: Clarify for-statement execution (GH-30025)
    281f980

    @terryjreedy terryjreedy added the type-feature A feature request or enhancement label Apr 3, 2022
    @terryjreedy terryjreedy added the type-feature A feature request or enhancement label Apr 3, 2022
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant