Skip to content

Add examples to docs for str methods #106318

Open

Activity

terryjreedy

terryjreedy commented on Jul 1, 2023

@terryjreedy
Member

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.

adorilson

adorilson commented on Jul 3, 2023

@adorilson
Contributor

Hi, folks. Thank you for your review and suggestions. All of them were applied (letting For example at the end of the paragraph). Maybe except in the splitlines method. It is because there is a table between the first paragraph and the example. So, we can:

  1. Leave as is
  2. Move the example (maybe just the first one) to after the first paragraph

Another idea here?

Another thing is about versionadded:: 3.2. What do you think about removing it.
The reason is that 3.2 is an old version (after end-of-file)? There are some rules about this?

rhettinger

rhettinger commented on Jul 9, 2023

@rhettinger
Contributor

The main question is whether the examples are worth the space.

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.

AlexWaygood

AlexWaygood commented on Jul 9, 2023

@AlexWaygood
Member

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.

adorilson

adorilson commented on Sep 17, 2023

@adorilson
Contributor

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?

image

AlexWaygood

AlexWaygood commented on Sep 17, 2023

@AlexWaygood
Member

Do you mean something like this?

yes

AA-Turner

AA-Turner commented on Sep 19, 2023

@AA-Turner
Member
No description provided.
adorilson

adorilson commented on Nov 4, 2023

@adorilson
Contributor

Hi, people.

I opened a new PR (#111743 ).
As said there, I would like a "go ahead" to confirm that the work will be valid.

ezio-melotti

ezio-melotti commented on Jan 23, 2024

@ezio-melotti
Member
No description provided.
added a commit that references this issue on May 24, 2024

Merge pull request #1 from blaisep/pr-105670

098d9f3

59 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Add examples to docs for str methods · Issue #106318 · python/cpython

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant