-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
Conversation
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. |
Thanks @DimitrisJim :-) |
There was a problem hiding this 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.
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. |
@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 |
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. |
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, |
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