Skip to content

+= Addition Assignment documentation is incorrect #21

@RamNewton

Description

@RamNewton

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions