Skip to content

bpo-29414: Change 'the for statement is such an iterator' in Tutorial #273

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

Merged
merged 7 commits into from
Jun 1, 2019
Merged

bpo-29414: Change 'the for statement is such an iterator' in Tutorial #273

merged 7 commits into from
Jun 1, 2019

Conversation

marco-buttu
Copy link
Contributor

@marco-buttu marco-buttu commented Feb 24, 2017

The sentence "the for statement is such an iterator", at the end of the section The range() function, is misleading. This PR fixes that sentence and completes the paragraph. For the whole discussione look at [bpo-29414](http://bugs.python.org/issue29414l).

https://bugs.python.org/issue29414

@DimitrisJim
Copy link
Contributor

Just spotted a small typo unrelated to the main change :-). The last sentence should read "arguments" instead of "argument". Other than that, the change LGTM.

@marco-buttu
Copy link
Contributor Author

Thanks @DimitrisJim :-)

Copy link

@wm75 wm75 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that list is a class and that's why you cannot use it as an example of a function that takes an iterable, but by discarding list(range(5)) from the section you lose the important demonstration of how to turn a range into an actual list. Now the preceding example only shows the "strange" behavior of print(range(10)), but it's never shown how to really print those numbers.
Also, if you are picky about list not being a function, you should most certainly change the section title (The range() function) and its first sentence about the built-in function range.

@wm75
Copy link

wm75 commented Feb 27, 2017

While you're at it, you could look into the subsequent section, too. It talks about "Loop statements may have an else clause; it is executed when the loop terminates through exhaustion of the list" and you could replace "list" with "iterable" here again.
Further down In that section you could also fix another typo:
"When used with a loop, the else clause has more in common with the else clause of a try statement than it does that of if statements" should be
"When used with a loop, the else clause has more in common with the else clause of a try statement than it does with that of if statements".

@marco-buttu
Copy link
Contributor Author

@wm75, good points. I added an example about range to list. I also added an extra whitespace after the dots, at the end of the sentences, to be consistent with the rest of the doc. Thank you very much

@wm75
Copy link

wm75 commented Feb 28, 2017

The more I look at this chapter, the more I think that it needs a bigger restructuring. I don't even think any more that range deserves its own section in a chapter on control flow. I think I'll try my hands on a more radical rewrite of the chapter, but I think I'll add it to the original #bpo-29414 on the issue tracker first to get a broader discussion.

@brettcannon
Copy link
Member

To try and help move older pull requests forward, we are going through and backfilling 'awaiting' labels on pull requests that are lacking the label. Based on the current reviews, the best we can tell in an automated fashion is that a core developer requested changes to be made to this pull request.

If/when the requested changes have been made, please leave a comment that says, I have made the requested changes; please review again. That will trigger a bot to flag this pull request as ready for a follow-up review.

@matrixise matrixise added the docs Documentation in the Doc dir label May 15, 2019
@rhettinger rhettinger merged commit 218e47b into python:master Jun 1, 2019
jaraco pushed a commit that referenced this pull request Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants