-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Add examples to docs for str methods #106318
Comments
The main question is whether the examples are worth the space. For some readers, details are definitely useful. I wonder if some of them might better be put inline in the description. |
Hi, folks. Thank you for your review and suggestions. All of them were applied (letting
Another idea here? Another thing is about |
I think the answer is mostly "No". In my courses, I ask people to read the string docs to become familiar with the methods. What I've learned is a) the docs are clear enough without having an example, and b) it already is too long and tedious to read. IMO, a well-intended effort to add examples would be counter-productive and make the docs less useful. Also, it is already trivially easy to run experiments to verify understanding (the string methods require almost no setup to try out). FWIW, the argparse docs are a example (no pun intended) of the consequences of going overboard with examples. Instead of one or two informative examples for the whole module, they are were added at a fine-grained level. As a result, we almost never can get anyone to read the docs top to bottom to gain a full understanding of the module. |
Perhaps we could put these examples in expandable sections that are hidden by default, like we recently did for the "relevant PEPs" section of the typing docs: https://docs.python.org/3.12/library/typing.html#relevant-peps. |
Do you mean something like this? And @rhettinger, what do you think about it? |
yes |
The only problem is that man pages, LaTeX, epub, etc (to my knowledge) don't have the concept of expandable sections. See sphinx-doc/sphinx#10532 (comment) for some context. On the other hand, this would be useful even if we make the collapsible content HTML only. A |
Hi, people. I opened a new PR (#111743 ). |
We recently had a few discussions related to this, including in the last docs-community meeting or on Discord.
Until a better solution for collapsible sections is found, and if adding more example inline it's not desirable for the |
pythonGH-106318: resolving unrelated merge conflicts
pythongh-106318: Merge pull request #1 from blaisep/pr-105670
@adorilson already opened a PR for this over at #105670. If people have higher level feedback on the suggestion, this issue is a good place to do it.
Maybe cc @CAM-Gerlach in case you're interested :-)
Linked PRs
str
methods in collapsible sections #111743The text was updated successfully, but these errors were encountered: