bpo-29428: make doctest documentation clearer#45
Conversation
Clarify the introduction of section, "How are Docstring Examples Recognized", by moving it to above the example and rewriting for clarity. Change the example in that section to use more plausible code, which also demonstrates a multi-line test fixture. Add three "fine print" points, about the example prefix strings, blank expected output, and multi-line expected output. Clarify the introduction of section, "What's the Execution Context", by rewriting for clarity, and breaking into three paragraphs. Copy-edit the first paragraph in section, "Which Docstrings Are Examined?".
bitdancer
left a comment
There was a problem hiding this comment.
Thanks for the suggestions. I have a bunch of tweaks to suggest :)
Note that since you are mostly changing whole paragraphs, you should go ahead and reflow them.
Sorry, something went wrong.
JDLH
left a comment
There was a problem hiding this comment.
Responses to David (bitdancer's) review comments. A good share of them should be adopted. More review welcome.
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #45 +/- ##
==========================================
- Coverage 82.37% 82.37% -0.01%
==========================================
Files 1427 1427
Lines 350948 350948
==========================================
- Hits 289089 289081 -8
- Misses 61859 61867 +8Continue to review full report at Codecov.
|
Sorry, something went wrong.
|
Commits a140a7f and 62a9a46 address those of @bitdancer 's comments with which I agree. There are still some paragraphs where we are not yet resolved. Please continue reviewing. |
Sorry, something went wrong.
|
On Tue, 14 Feb 2017 00:20:30 -0800, Jim DeLaHunt wrote:
I take it back. Everyone of my Python versions, 2.7 from Macports, 2.7
from Apple, 3.7 from master, 3.6 from Macports, all print out a
sys.ps2 prompt after a comment-only line. How does your copy of
Python behave? If the sys.ps2 prompt is what every current Python
shell does, then I think the example should reflect that.
Like yours. I still think it's a bug. If I'm wrong, and you open an
issue about it, someone will tell us :)
|
Sorry, something went wrong.
|
Sorry to say that overall I don't think this reads any better than what we have now and is in some ways worse. Instead of a rewrite effort, please focus on any one part that have reason to believe to be misleading. These docs have been around a long time and have worked reasonably well for a lot of users. Much of this I believe was written originally by Tim Peters who has knack for saying just what needs to be said. |
Sorry, something went wrong.
|
@rhettinger Thank you for looking at this. I'm sorry to hear that it doesn't read any better for you. This is not a rewrite effort. This is a targeted change to those sections where inadequate explanation misled me when I was writing my doctests. Specifically the existing docs aren't clear about when to use Perhaps you could point out the places where this version is worse? I could improve those. Comments from others? |
Sorry, something went wrong.
JulienPalard
left a comment
There was a problem hiding this comment.
Hi JDLH and thanks for your efforts. First sorry it takes us too long for providing feedback.
It would help if you keep your changes atomic, and your messages short on b.p.o: It's hard to review a PR that changes a lot of paragragraphs sometimes completly unlinked to the original issue, and when messages take a whole screen on b.p.o it's also long to read which can slow the review process.
I understand that's frustrating to have changes rejected, as I previously said atomic obvious changes are more likely to be merged quickly, you probably gone too far on this one.
Sorry, something went wrong.
|
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 |
Sorry, something went wrong.
|
Reviewers: Thank you very much for your attention to this PR and to bpo-29428. I have a feeling we are getting stuck. I have a feeling that part of the problem is that the Github review process doesn't work as well for diffuse issues in a document as it does for atomic issues in code. Part of the problem is that Github doesn't give us tools to have a conversation. Part of the problem is that reasonable people can disagree about writing style (I received contradictory feedback from reviewers). If we were in a company, this would be the point where I would propose having a meeting. We could talk through the issues. But this is the Python project. I don't know what the best way to make progress is. What should I do to make progress? The fundamental problem I want to solve with this P.R. is: I wanted to write a doctest which required an A secondary goal is to improve the document overall. I see unclear writing and inconsistent terminology. I hear pushback against changes that are not "atomic". Overall document improvements won't be atomic. How does the Python project improve documents overall? Also, In https://bugs.python.org/msg286973 Marco Bhutto proposed adding a Howto for doctests. A Howto might be a way to make progress on my goals, but I fear that a newbie like me will not be able to write a Howto that will survive the sort of review this PR has received. |
Sorry, something went wrong.
Thank you for contributing, I see this thread is way too long for your original goal.
The documentation (https://docs.python.org/3.6/library/doctest.html#simple-usage-checking-examples-in-a-text-file) give this exact example of separating the import and example:
This is probably why your PR is stuck, it make your PR too big for the original issue. Try to fix your issue first, as simply as possible, and then, in another PR, try to improve the document overall.
An issue and a PR about them would be appreciated, let's not pollute this already bloath thread with out-of-topic issues.
Yes, atomic chances are faster to review and faster to merge. As you said you're trying to fix an issue AND improving the overall document, this is a "comment magnet" as you see.
Overall improvements can also be specifics: First fix the inconsistency on a single word. Then another word. Then a paragraph. Then add an example. Then ...
Run "git log -p Doc/" in your
In one hand it looks like a big chunk to do. In the other, being a newcomer can help you to know what should be explained to newcomers, so it may end up interesting for other newcomers. Anyway please open a separate issue / PR to discuss this.
First, don't get bit by https://en.wikipedia.org/wiki/Sunk_cost this is not because we all (especially you) spent a lot of time on this PR that it have to still grow. I'll in contrast simplify the PR a lot. Look the paragraph [https://docs.python.org/3.6/library/doctest.html#what-s-the-execution-context](26.3.3.3. What’s the Execution Context?), it's really short, and it is the one explainig the scope (This is the one containing the sentence "and names defined earlier in the docstring being run", directly in relation with your issue) maybe you can add your example in it (the one with import math). But refrain from also demoing the ";" in it, it's another example, showing something else, don't mix them, it just make them hard to read. There's probably other places where |
Sorry, something went wrong.
Thanks @JDLH for taking the time to create a PR, and thanks to @bitdancer, @JulienPalard, and @rhettinger for the effort to review. I'm recommending that this PR be closed as it is languishing due to its scope being too broad. If you wish to break this PR up into a smaller PR with one atomic change, I will be happy to review the new PR. Thanks. |
Sorry, something went wrong.
Fix parameter markup Closes python#45 See merge request python-devs/importlib_resources!46
python#45) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
A fix for bug bpo-29428, Doctest documentation unclear about multi-line fixtures.
This changes Doc/library/doctest.rst only. No code changes.
Clarify the introduction of section, "How are Docstring
Examples Recognized", by moving it to above the example
and rewriting for clarity.
Change the example in that section to use more plausible
code, which also demonstrates a multi-line test fixture.
Add three "fine print" points, about the example prefix
strings, blank expected output, and multi-line expected
output.
Clarify the introduction of section, "What's the Execution
Context", by rewriting for clarity, and breaking into three
paragraphs.
Copy-edit the first paragraph in section, "Which Docstrings
Are Examined?".