-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
gh-100101: Clarify documentation of zip()'s strict option #100103
gh-100101: Clarify documentation of zip()'s strict option #100103
Conversation
✅ Deploy Preview for python-cpython-preview ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Looks like doctest does not support having both output and an exception in an example, but that's the entire point here: showing that the loop body is executed up to the point where the error condition (one iterable being exhausted) is hit. Any ideas? |
You could try a |
Yeah, I suppose that would work around it, but it'd also add significant noise to the example (five lines instead of two). :-/ |
For reference, this is the old open issue about doctest not supporting this: #65382. (Thanks, han-solo!) Looks like I have finally found a real-world stdlib use case for this feature. :-) |
In that case, maybe just a comment above the line saying what it'll print (or the length) would work to be less noisy, though at that point the output wouldn't exactly match the display so also not too certain about that. |
The only alternative I can think of is disabling the test for that example using |
There is in fact precedent for skipping such doctests (although I'm not entirely sure why it was necessary there), so I'm going to propose doing the same thing here and enabling the test again in the future when doctest gains that functionality. In my opinion, a clear example of the exact |
9636826
to
c7e0e5e
Compare
0135976
to
367a2c5
Compare
…doesn't get indented
367a2c5
to
50d35d1
Compare
Thanks @JustAnotherArchivist for the PR, and @brandtbucher for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
Thanks! |
GH-100594 is a backport of this pull request to the 3.11 branch. |
GH-100595 is a backport of this pull request to the 3.10 branch. |
…GH-100103) (cherry picked from commit cf1c098) Co-authored-by: JustAnotherArchivist <JustAnotherArchivist@users.noreply.github.com>
…GH-100103) (cherry picked from commit cf1c098) Co-authored-by: JustAnotherArchivist <JustAnotherArchivist@users.noreply.github.com>
Issue: #100101
zip()
'sstrict
option #100101