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

bpo-30940: fix docs for round if second arg is None #2824

Closed
wants to merge 4 commits into from

Conversation

daxlab
Copy link
Contributor

@daxlab daxlab commented Jul 23, 2017

@mention-bot
Copy link

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

@@ -1308,8 +1308,8 @@ are always available. They are listed here in alphabetical order.
equally close, rounding is done toward the even choice (so, for example,
both ``round(0.5)`` and ``round(-0.5)`` are ``0``, and ``round(1.5)`` is
``2``). Any integer value is valid for *ndigits* (positive, zero, or
negative). The return value is an integer if called with one argument,
otherwise of the same type as *number*.
negative). The return value is an integer if *ndigits* is omitted or *None*.
Copy link
Member

Choose a reason for hiding this comment

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

Format None with fixed-width font instead of italic.

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.

Needed to update the docstring too.

The signature of the function can be written as

round(number, ndigits=None)

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for doing this!

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Jul 23, 2017

Please update the docstring.

And what is more correct,

if *ndigits* is omitted or is ``None``

(as in the first paragraph), or

if *ndigits* is omitted or ``None``

(as in the second paragraph)? Or both are correct?

@daxlab
Copy link
Contributor Author

daxlab commented Jul 23, 2017

if *ndigits* is omitted or ``None`` looks correct.

@@ -2086,7 +2086,7 @@ builtin_round(PyObject *self, PyObject *args, PyObject *kwds)
}

PyDoc_STRVAR(round_doc,
"round(number[, ndigits]) -> number\n\
"round(number, ndigits=None) -> number\n\
\n\
Round a number to a given precision in decimal digits (default 0 digits).\n\
This returns an int when called with one argument, otherwise the\n\
Copy link
Member

Choose a reason for hiding this comment

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

"if ndigits is omitted or None"

@mdickinson
Copy link
Member

About

if ndigits is omitted or is None

versus

if ndigits is omitted or None

I think either is fine. To my eyes, the first looks a bit clearer, but also a bit more pedantic.

@daxlab
Copy link
Contributor Author

daxlab commented Jul 24, 2017

@serhiy-storchaka docs updated.

@daxlab
Copy link
Contributor Author

daxlab commented Aug 27, 2017

@serhiy-storchaka plz review. Also, should I send a separate PR to 3.6 branch or you can cherry-pick ?

@serhiy-storchaka
Copy link
Member

The current changes LGTM, but see a discussion on the tracker. Perhaps the documentation needs additional clarification.

@ned-deily
Copy link
Member

Based on more recent discussion on the tracker, it looks these proposed changes have now been addressed by other PRs, primarily #6342 and #2740. Thanks for starting the ball rolling @daxlab!

@ned-deily ned-deily closed this Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting merge docs Documentation in the Doc dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants