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

+= Addition Assignment documentation is incorrect #21

Open
RamNewton opened this issue May 26, 2020 · 0 comments · May be fixed by #50
Open

+= Addition Assignment documentation is incorrect #21

RamNewton opened this issue May 26, 2020 · 0 comments · May be fixed by #50

Comments

@RamNewton
Copy link

The Remarks Section says

Equivalent to A = A + B.

But that is not true. += operator uses __iadd__ method, if it is defined.
If it's not defined, then it uses the __add__ method.

__iadd__ method does addition in place.
__add__ method adds the two objects and returns a new object.

In depth discussion can be found here : https://stackoverflow.com/a/2347423/13345708

The Remarks can be edited to say

Equivalent to A = A + B, if iadd method is not defined

Yash-op7 added a commit to Yash-op7/python-reference that referenced this issue Sep 4, 2024
@Yash-op7 Yash-op7 linked a pull request Sep 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant