Skip to content

Error in description of __iadd__() method #138144

@Flyagin

Description

@Flyagin

Documentation

In the documentation, in the description of __iadd__() and other similar methods implementing the augmented arithmetic assignments (+=, -=, *=, /=, //=, %=, **=, <<=, >>=, &=, ^=, |=), the following contradiction (as it seems to me) occurs:

  1. "These methods should attempt to do the operation in-place (modifying self)"
  2. "For instance, if x is an instance of a class with an __iadd__() method, x += y is equivalent to x = x.__iadd__(y)"

As far as I understand, if __iadd__() method attempts to do the operation "in-place (modifying self)", then “x =” at the beginning of this statement:

x = x.__iadd__(y)

is redundant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions