This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年10月12日 09:03 by chris.jerdonek, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue-16209-1-default.patch | chris.jerdonek, 2012年11月25日 06:08 | review | ||
| issue-16209-2-default.patch | chris.jerdonek, 2012年11月25日 18:07 | review | ||
| issue-16209-3-default.patch | chris.jerdonek, 2012年11月28日 04:53 | review | ||
| Messages (10) | |||
|---|---|---|---|
| msg172733 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年10月12日 09:03 | |
This issue is to add a str class entry to the built-in types page like we have for dict, set, memoryview, etc: http://docs.python.org/dev/library/stdtypes.html This will let us reference ``str`` the class separately from ``str()`` the built-in function. It will also let us remove the "str." prefix from all of the string method descriptions. Thirdly, it will make the str documentation match what is being done for the types previous to it in the documentation, including the range, tuple, and list classes. Lastly, it will make referencing string-related sections in Sphinx a bit more intuitive. Currently, :class:`str` points to the built-in function :func:`str`. |
|||
| msg172795 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年10月13日 04:12 | |
This sort of request came up before, the last time only a few months ago if memory serves. The shot answer is that str is a built-in function as well as a class, and trying to split hairs over that does not really add value to the docs. I can dig up the issue(s) if you don't find them. |
|||
| msg172797 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年10月13日 05:36 | |
Let me start over with what I'm suggesting, because the idea wasn't fully developed when I first filed this issue. I'm thinking that we should create a class entry for str that contains the current string methods nested beneath it -- a bit like issue 12901. :) In conjunction with that, we should move the documentation of the str() function to the constructor for that class entry. All str links throughout the documentation would go to the class entry, and the built-in function str() would be a stub entry that also links to the class entry. That's how we do it for dict, for example: http://docs.python.org/dev/library/functions.html#func-dict One reason is practical. By doing the above, clicking "str" anywhere in the docs will take you to the documentation for both the function str() and the string methods. When I was first learning Python, it was very common for me to look up the "String Methods" section. But looking them up never seemed as convenient as it should be because they were in a different location. I always had to remember they were an extra click or two away in a separate "String Methods" section. In 3.3 we made a bit of progress on this by giving the string type its own section: http://docs.python.org/dev/library/stdtypes.html#text-sequence-type-str But we could go further by doing what we do for list, tuple, set, memoryview, range, etc. and put the documentation of the str() function and its methods next to each other in the same location. |
|||
| msg176331 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年11月25日 06:08 | |
Attaching patch. Adding Nick to the nosy list because he did the work of originally breaking out the "Text Sequence Type" section for issue #4966, as well as Terry who created that issue. I view the current issue and patch as a progression of some of the issues discussed in that issue. |
|||
| msg176337 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年11月25日 10:47 | |
Right, aside from my recent revamp, much of the existing layout of the types section has been inherited from the pre-new style classes days when you *couldn't* inherit from types, and strings were the only one with a non-trivial number of methods. Rearranging as Chris suggests makes sense to me - my work was certainly only intended to be the *start* of improvements to the builtin type docs. The main thing to watch out for is ensuring we don't break any incoming deep links while rearranging things (perhaps by adding the appropriate explicit anchor targets). It's OK if some cases end up just linking to the page (e.g. that's what now happens to reference to the old monolithic sequence types section, as there's no obviously better destination), but in this case the old deep links should go to the new class docs. |
|||
| msg176338 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年11月25日 10:51 | |
The simpler approach Chris has taken here (i.e. just leaving the string methods separate from the class definition) also works. Patch looks good to me - I'm definitely in favour of moving towards a more consistent approach of having the builtin function definitions reference to full class definitions (as shown by the changes I made to the docs for the other sequence types). |
|||
| msg176377 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年11月25日 17:22 | |
> The simpler approach Chris has taken here (i.e. just leaving the string methods separate from the class definition) also works. Yes, though I mentioned nesting the string methods beneath the class entry in the original post for this issue, I figured we could start smaller and do this in more manageable steps. We can do the bigger change (in the sense of being a bigger diff) of indenting as part of a second issue/patch. |
|||
| msg176380 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年11月25日 18:07 | |
Updating patch to fix up affected/related index entries. |
|||
| msg176509 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年11月28日 04:53 | |
Attaching new patch to address Ezio's suggestions on Rietveld. |
|||
| msg176525 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年11月28日 09:46 | |
New changeset 0097379df2e1 by Chris Jerdonek in branch '3.3': Add a str class entry to the "Text Sequence Type" section (issue #16209). http://hg.python.org/cpython/rev/0097379df2e1 New changeset 81ac75c64780 by Chris Jerdonek in branch 'default': Merge from 3.3: Add a str class entry to the string section (issue #16209). http://hg.python.org/cpython/rev/81ac75c64780 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:37 | admin | set | github: 60413 |
| 2012年11月28日 10:03:18 | chris.jerdonek | link | issue16205 superseder |
| 2012年11月28日 09:50:51 | chris.jerdonek | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2012年11月28日 09:46:22 | python-dev | set | nosy:
+ python-dev messages: + msg176525 |
| 2012年11月28日 04:53:58 | chris.jerdonek | set | files:
+ issue-16209-3-default.patch messages: + msg176509 |
| 2012年11月25日 18:07:56 | chris.jerdonek | set | files:
+ issue-16209-2-default.patch messages: + msg176380 |
| 2012年11月25日 17:22:02 | chris.jerdonek | set | messages: + msg176377 |
| 2012年11月25日 10:51:45 | ncoghlan | set | messages: + msg176338 |
| 2012年11月25日 10:47:22 | ncoghlan | set | messages: + msg176337 |
| 2012年11月25日 06:08:32 | chris.jerdonek | set | files:
+ issue-16209-1-default.patch nosy: + terry.reedy, ncoghlan messages: + msg176331 keywords: + patch stage: patch review |
| 2012年10月13日 05:36:22 | chris.jerdonek | set | messages: + msg172797 |
| 2012年10月13日 04:12:32 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg172795 |
| 2012年10月12日 11:44:12 | ezio.melotti | link | issue16205 dependencies |
| 2012年10月12日 09:03:17 | chris.jerdonek | create | |