-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-34764: improve docs example of iter() with sentinel value #11222
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
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
Actually is it necessary to set |
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 would like to keep something closer to the original. The random() example is not a motivating use case. Instead, consider a block-reader example or some other non-toy use case:
# Read data in chunks
for block in iter(partial(f.read, 128), ''):
...
This partial() can be replaced with lambda: f.read(128)
or with a def statement.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
bad271d
to
f6f0860
Compare
Thanks @rhettinger, I have tried to make the requested changes; please review again |
Doctest fails on Travis since |
7bcbf27
to
fc05a24
Compare
9f7a9d1
to
e15c552
Compare
1bb9d6c
to
ab611eb
Compare
87e4d8a
to
747ee53
Compare
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.
Fixed-length block reads would be more typical for binary data.
272b50e
to
b01f506
Compare
Thanks @rhettinger for your patience! I have made the requested changes (and fixed the indentation); please review again |
Thanks @chris-rands for the PR, and @rhettinger for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
GH-11301 is a backport of this pull request to the 3.7 branch. |
https://bugs.python.org/issue34764