GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-67748: DOC:Add summary table for str methods in stdtypes.rst by csabella · Pull Request #1709 · python/cpython Conversation
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is this paragraph necessary? It seems obvious just given the section and table headings.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Martin. You're right. I wasn't quite sure where to place this overall and thought there would probably be suggestions, so I kept it vague. There wasn't a section that combined both text and binary sequence types before and I didn't know if people would like having str and bytes (and bytearray) types all in one table or if there should be a separate table for each one under the existing sections.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@vadmium Thanks for your comments. I hope others chime in. Being fairly new to Python, I've found my chart (or your changes) very helpful in using the right str functions. To your point, it didn't really do much to shorten the page though. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| +==========================+==============================+==============================+ | ||
| | Formatting | :meth:`str.format` | | | ||
| + +------------------------------+------------------------------+ | ||
| | | :meth:`str.format_map` | | |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe __mod__ (%) should be included here too.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've added some lines for the printf-style and for f-strings. I think I linked them to the best places for a description.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| | Category | str methods | bytes methods | | ||
| +==========================+==============================+==============================+ | ||
| | Formatting | :meth:`str.format` | | | ||
| + +------------------------------+------------------------------+ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think the leftmost + can/should be a |.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| + +------------------------------+------------------------------+ | ||
| | | :meth:`str.index` | :meth:`bytes.index` | | ||
| + +------------------------------+------------------------------+ | ||
| | | :meth:`str.rindex` | :meth:`bytes.rindex` | |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the methods and their corresponding rmethods could be combined on the same line to make the table more compact. If however the end result isn't more readable, you could leave them separate.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I added the methods and rmethods on the same lines, but I did it 2 different ways so that you could pick which one you prefer. find\rfind and index\rindex are done as columns while split\rsplit, ljust\rjust, and lstrip/rstrip are done as or.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| sections. In addition, see the :ref:`stringservices` section. | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Was this change intentional?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that! I've removed it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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.
There was an error while loading. Please reload this page.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @ezio-melotti: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ezio-melotti Do you review this PR? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This is how the (first half of the) table looks like. The table intentionally splits some cells and uses a One issue with the table is that it takes over a page and it has a lot of whitespace. Maybe we could do something that looks like this instead (using a proper colspan):
We lose the direct mapping from |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hmm, well take my opinion as just one data point, but while I do definitely see the concern of it being rather long, at least from what I can see so far, I find the current format a good deal easier to skim and consult as a structured summary, at least personally to my eyes. If we're going to go with a structure similar to what you propose, I'm not sure if we even need a table at all, as opposed to just a bulleted list, which has essentially the same structure, is even more compact and is simpler to read and write, e.g.
Meanwhile, the original table could be made more compact and maintainable, at least in the source, by formatting it as a Also, of the two styles, FWIW a real cell split rather than a raw |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
See also these issues: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ezio-melotti I'm going through and rebooting and/or closing old Docs PRs. This one looks good and is an improvement over not having it. Would you be cool with merging? There would always be the option to iterate on it in the future. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| +--------------------------+-------------------------------------------+---------------------------------------------------+ | ||
| | Splitting and Joining | :meth:`str.split` | :meth:`str.rsplit` | :meth:`bytes.split` | :meth:`bytes.rsplit` | | ||
| +--------------------------+-------------------------------------------+---------------------------------------------------+ |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The r/l pairs (split/rsplit, ljust/rjust, lstrip/rstrip) need +s to render as table cells:
| +--------------------------+-------------------------------------------+---------------------------------------------------+ | |
| | Splitting and Joining | :meth:`str.split` | :meth:`str.rsplit` | :meth:`bytes.split` | :meth:`bytes.rsplit` | | |
| +--------------------------+-------------------------------------------+---------------------------------------------------+ | |
| +--------------------------+-------------------+-----------------------+---------------------+-----------------------------+ | |
| | Splitting and Joining | :meth:`str.split` | :meth:`str.rsplit` | :meth:`bytes.split` | :meth:`bytes.rsplit` | | |
| +--------------------------+-------------------+-----------------------+---------------------+-----------------------------+ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I agree that it's an improvement and can be iterated on. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.