Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes docstring and doc format.
  • Loading branch information
lisroach committed Sep 13, 2018
commit 89a0d9d9e75bcfd78bd749722b340692279befe2
2 changes: 1 addition & 1 deletion Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ class`. In addition, it provides a few more methods:

Return a pair of integers whose ratio is exactly equal to the original
integer and with a positive denominator. The integer ratio of integers
(whole numbers) is always the integer as the numerator and 1 as the
(whole numbers) is always the integer as the numerator and ``1`` as the
denominator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A versionadded directive needs to be added. Also, the developer's guide states that reST files should use an indentation of 3 spaces.

.. versionadded:: 3.8
Expand Down
6 changes: 2 additions & 4 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5270,12 +5270,10 @@ and with a positive denominator.

>>> (10).as_integer_ratio()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need so much examples in a docstring?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's useful to have at least one positive and one negative example, so that it's obvious at a glance that the behaviour for negatives is to give (for example) (-5, 1) rather than (5, -1). I could imagine users thinking that 0 was somehow a special case, too, so I like that we have the 0 example there.

(10, 1)
>>> (0).as_integer_ratio()
(0, 1)
>>> (11).as_integer_ratio()
(11, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
[clinic start generated code]*/

static PyObject *
Expand Down