Skip to content
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

Corrected link targets in collections.rst #1052

Merged
merged 6 commits into from
Mar 26, 2018
Merged

Corrected link targets in collections.rst #1052

merged 6 commits into from
Mar 26, 2018

Conversation

MSeifert04
Copy link
Contributor

@MSeifert04 MSeifert04 commented Apr 8, 2017

Fixes several link targets in library.collections.rst.

There are 3 remaining "invalid" links:

  • list.append, because there is no "target" for that method. There is something documented in tutorial/datastructures but these are not valid link targets.
  • defaultdict.get, because it's not explicitly documented. Should it link to dict.get?
  • OrderedDict.update, because it's not explicitly documented. Should it link to dict.update?

@mention-bot
Copy link

@MSeifert04, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rhettinger, @Yhg1s and @birkenfeld to be potential reviewers.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, but I have some comments.

@@ -357,21 +357,22 @@ or subtracting from an empty counter.
restrictions on its keys and values. The values are intended to be numbers
representing counts, but you *could* store anything in the value field.

* The :meth:`most_common` method requires only that the values be orderable.
* The :meth:`~Counter.most_common` method requires only that the values be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change also :func:'most_common' above to :meth:'most_common'.

the :meth:`rotate` method to position elements to be popped::
The :meth:`~deque.rotate` method provides a way to implement :class:`deque` slicing
and deletion. For example, a pure Python implementation of ``del d[n]`` relies on
the :meth:`~deque.rotate` method to position elements to be popped::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using the same link multiple times in one paragraph. ``rotate()`` would look better.

passed to the :class:`OrderedDict` constructor and its :meth:`update`
method.
passed to the :class:`OrderedDict` constructor and its
:meth:`update` method.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is changed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing.

I originally changed it to dict.update but then I wasn't sure if that was what was intended and reverted it again. Just forgot to revert all of the change.

@@ -1175,6 +1176,11 @@ attribute.
subclass) or an arbitrary sequence which can be converted into a string using
the built-in :func:`str` function.

.. attribute:: data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be added the paragraph "In addition to supporting ..." as for UserDict and UserList?

@@ -1175,6 +1176,11 @@ attribute.
subclass) or an arbitrary sequence which can be converted into a string using
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This phrase is outdated (remained from Python 2). Virtually any object (not just sequences) can be converted into a string using str(). However bytes is bad example, it emits a warning or an exception when converted to str.

be an instance of :class:`bytes`, :class:`str`, :class:`UserString` (or a
subclass) or an arbitrary sequence which can be converted into a string using
the built-in :func:`str` function.
contents are initially set to a copy of *seq*. The *seq* can
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“The *seq*” is missing a noun. I would either write “*Seq* can . . .” or “The *seq* argument can . . .”. Changing the parameter name makes this problem worse.

Copy link
Member

@orsenthil orsenthil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@serhiy-storchaka
Copy link
Member

@rhettinger could you please make a look as the collections module maintainer?

@Mariatta
Copy link
Member

I think this looks good, I just wonder if we need a ticket in b.p.o for this?

@rhettinger
Copy link
Contributor

Please hold off on this for while. I won't have a chance to go through every change in detail for a while. Some of the changes like func->meth or meth->attr look fine; however, a number of the meth entries were intentionally not made into link target (i.e. I mention rotate() several times in a row, I don't want them to all be links -- this just garbages the appearance without making the docs better. The double colon was left-off of the combination_with_replacement example on purpose because it includes sample output which isn't real code. That said, I think it looks better with the double colon, so I think I'll put a # comment on the line or somesuch. When proposing extensive edits, please don't rewrap the lines unless there is a major increase to line length, the rewrapping makes it harder to review.

@rhettinger rhettinger self-assigned this Apr 11, 2017
@MSeifert04
Copy link
Contributor Author

I haven't realized that this was an "extensive edit". If it would help I can seperate the different changes into seperate PRs (with accompanying issues on the tracker).

There are basically 4 changes here:

  • wrong target :meth: instead of :attr: or :func: instead of :meth:
  • missing data attribute and outdated documentation of Userstring
  • the double colon when referencing itertools.combinations
  • prepending the class to "not-linking" links

@MSeifert04
Copy link
Contributor Author

MSeifert04 commented May 12, 2017

How should I proceed with this PR?

@MSeifert04
Copy link
Contributor Author

Anything I can or should do?

It's a relatively small PR and it has been stalling for months now.

@MSeifert04
Copy link
Contributor Author

@rhettinger Is it worth fixing the conflicts? I don't want to invest more time into this PR if you don't like it.

@serhiy-storchaka serhiy-storchaka added skip news docs Documentation in the Doc dir labels Sep 16, 2017
@MSeifert04
Copy link
Contributor Author

@serhiy-storchaka Thanks for fixing the conflicts :)

I still wonder if it's worth keeping it open. There seems to be no interest in merging it, or is just that @rhettinger has no time to review it?

@serhiy-storchaka
Copy link
Member

All @rhettinger's comments looks addressed to me.

@MSeifert04
Copy link
Contributor Author

MSeifert04 commented Sep 23, 2017

There is one comment that I haven't addressed (I think) because I don't know which ones were meant:

however, a number of the meth entries were intentionally not made into link target (i.e. I mention rotate() several times in a row, I don't want them to all be links -- this just garbages the appearance without making the docs better.

@serhiy-storchaka
Copy link
Member

It was addressed before it was written. There are no more than one links to the same target in one paragraph. If rotate() is mentioned several times in a row, only the first occurrence is a link.

@MSeifert04
Copy link
Contributor Author

MSeifert04 commented Sep 25, 2017

okay - so what is holding up the PR?

@MSeifert04
Copy link
Contributor Author

@rhettinger Do you have time to review the PR?

@serhiy-storchaka serhiy-storchaka merged commit e105294 into python:master Mar 26, 2018
@miss-islington
Copy link
Contributor

Thanks @MSeifert04 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 26, 2018
(cherry picked from commit e105294)

Co-authored-by: Michael Seifert <michaelseifert04@yahoo.de>
@bedevere-bot
Copy link

GH-6257 is a backport of this pull request to the 3.7 branch.

@miss-islington
Copy link
Contributor

Sorry, @MSeifert04 and @serhiy-storchaka, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker e105294708ffc78a31566b48468746eb4609abe7 3.6

miss-islington added a commit that referenced this pull request Mar 26, 2018
(cherry picked from commit e105294)

Co-authored-by: Michael Seifert <michaelseifert04@yahoo.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.