| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
There was a problem hiding this comment.
:)
Sorry, something went wrong.
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
Thanks for the review, Nikita! |
Sorry, something went wrong.
…of the ``int.__round__`` (pythonGH-120088) (cherry picked from commit 57ad769) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
Sorry, @Eclips4 and @vstinner, I could not cleanly backport this to 3.12 due to a conflict. cherry_picker 57ad769076201c858a768d81047f6ea44925a33b 3.12 |
Sorry, something went wrong.
|
GH-120197 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
|
I merged the change. Thanks @Eclips4! I don't think that such change deserves to be backported. It's a minor issue. While @serhiy-storchaka disagrees with the change: #120080 (comment), IMO it makes the code more consistent. With this change, round(), float.__round__() and int.__round__() accept None for ndigits. It also makes help(nt.__round__) nicer. If tomorrow, we decide to reject None, it should be consistent and be rejected in the 3 ways to call "round". But I don't think that we want to reject None, it's convenient and works currently. Note: I would prefer to have 0 as the default value rather than None. But well, it's too change to change such detail :-) Internally, round(obj, None) calls obj.__round__() (0 arguments), whereas round(obj, ndigits) calls obj.__round__(ndigits) (1 argument). |
Sorry, something went wrong.
|
float.__round__() needs to distinguish 0 from no argument. Accepting None is just an implementation detail. I do not think we should add tests for this, because now this becomes a self-official feature. int.__round__() could have 0 as the default, this would simplify the code. |
Sorry, something went wrong.
The tests can be decorated with @support.cpython_only. |
Sorry, something went wrong.
…of the ``int.__round__`` (python#120088) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
…of the ``int.__round__`` (python#120088) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.