8000 bpo-34764: improve docs example of iter() with sentinel value by chris-rands · Pull Request #11222 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 9 commits into from
Dec 24, 2018

Conversation

chris-rands
Copy link
Contributor
@chris-rands chris-rands commented Dec 18, 2018

@the-knights-who-say-ni
Copy link

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
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Dec 18, 2018
@chris-rands
Copy link
Contributor Author

Actually is it necessary to set random.seed() in such documentation example code snippets to ensure that the output is reproducible?

Copy link
Contributor
@rhettinger rhettinger left a 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.

@bedevere-bot
Copy link

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@chris-rands
Copy link
Contributor Author

Thanks @rhettinger, I have tried to make the requested changes; please review again

@tirkarthi
Copy link
Member

Doctest fails on Travis since mydata.db is not present during execution. You can convert it back to a normal example code or wrap it inside a function and not calling it.

Copy link
Contributor
@rhettinger rhettinger left a 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.

@chris-rands
Copy link
Contributor Author

Thanks @rhettinger for your patience! I have made the requested changes (and fixed the indentation); please review again

@miss-islington
Copy link
Contributor

Thanks @chris-rands for the PR, and @rhettinger for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-11301 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 24, 2018
…GH-11222)

(cherry picked from commit d378b1f)

Co-authored-by: Chris Rands <c_rands100@hotmail.com>
rhettinger pushed a commit that referenced this pull request Dec 24, 2018
…) (#11301)

(cherry picked from commit d378b1f)

Co-authored-by: Chris Rands <c_rands100@hotmail.com>
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
Projects
4A5D None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0