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

Indicate that abs() method accept argument that implement __abs__(), … #7783

Closed
wants to merge 1,087 commits into from

Conversation

Windsooon
Copy link
Contributor

…just like call() method in the docs

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

When your account is ready, please add a comment in this pull request
and a Python core developer will remove the CLA not signed label
to make the bot check again.

Thanks again for your contribution, we look forward to reviewing it!

@Windsooon
Copy link
Contributor Author

I signed the CLA, Thank you for reviewing.

@eric-wieser

This comment has been minimized.

@Windsooon
Copy link
Contributor Author

@eric-wieser Thanks, I fixed it now.

Copy link
Contributor

@jdemeyer jdemeyer left a comment

Choose a reason for hiding this comment

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

I think the wording could be improved: what does "The argument may be an integer or a floating point number." really mean now? You should explain that this applies to integers, floating point numbers, complex numbers and anything defining __abs__.

@@ -43,8 +43,8 @@ are always available. They are listed here in alphabetical order.
.. function:: abs(x)

Return the absolute value of a number. The argument may be an
integer or a floating point number. If the argument is a complex number, its
magnitude is returned.
integer or a floating point number, If *x* defines :meth:`__abs__`,
Copy link
Member

Choose a reason for hiding this comment

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

There's a capital letter after a coma.
Also I have another proposition about this coma:

[...] integer, a floating point number, a complex number, or any object defining the :meth:__abs__ method. If the argument is a complex number, its magnitude is returned.

I agree with @jdemeyer, it could be "simplified" even to Accept any object *x* implementing :meth:`__abs__` , but this documentation is not the language reference, its audience is newcomers, they care about being able to pass the three builtins they just learnt int, float, complex like abs(-5) and abs(-5.5).

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@csabella
Copy link
Contributor

csabella commented Feb 4, 2020

@Windsooon, please resolve the merge conflict and address the code review comments. Thank you!

@eric-wieser

This comment has been minimized.

@Windsooon Windsooon changed the title Indicate that add() method accept argument that implement __abs__(), … Indicate that add() method accept argument that implement __add__(), … Feb 4, 2020
@Windsooon
Copy link
Contributor Author

Windsooon commented Feb 4, 2020

To make it easier, how about

"... integer or a floating point number or anything defining __abs__. If the argument is a complex number, its magnitude is returned."

@eric-wieser

This comment has been minimized.

@Windsooon Windsooon changed the title Indicate that add() method accept argument that implement __add__(), … Indicate that abs() method accept argument that implement __abs__(), … Feb 4, 2020
@Windsooon
Copy link
Contributor Author

Sorry for the mistake. I just fixed it.

@JulienPalard
Copy link
Member

To make it easier, how about

"... integer or a floating point number or anything defining __abs__. If the argument is a complex number, its magnitude is returned."

Yes, by using

:meth:`__abs__`

instead of a raw abs.

I'm not a native english speaker but I think the first or is now redundent, what about:

The argument may be an integer, a floating point number, or anything defining :meth:`__abs__`.

I'd maybe prefer a bit object over anything, like:

The argument may be an integer, a floating point number, or an object implementing :meth:`__abs__`.

@Windsooon
Copy link
Contributor Author

@JulienPalard Thank you. I updated the PR based on your suggestion.

@JulienPalard
Copy link
Member

@Windsooon could you resolve the conflict?
I would personally do it using git fetch upstream; git rebase upstream/master (my python/cpython remote being named upstream), as your PR is based on a commit from 2018.

@terryjreedy
Copy link
Member

rebase commonly messes up branches and PRs with the cpython workflow. Did you do git merge in master before updating the branch? git merge upstream/master usually works. There might be a merge conflict, but not likely with a narrow PR like this one. You could still try merge on your local branch if not deleted yet.

@Windsooon
Copy link
Contributor Author

@terryjreedy Thank you. I just delete the old branch. However, I don't know why my PR will conflict with the current master branch. I will check it out later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet