You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the documentation for in-place operations (__iadd__, __isub__, etc.), it states "Return self+=value." However, an in-place operation (self+=value) is a statement, not an expression, so it does not have a return value.
Idea or request for content:
The description should be same as self+=value, perform self+=value or something similar.
The text was updated successfully, but these errors were encountered:
The docstring is indeed not very clear, but the __iadd__ operator does actually return an array; it is just that value is added in-place and then self is returned:
In [2]: a = np.arange(5.0)
In [3]: a.__iadd__(1)
Out[3]: array([1., 2., 3., 4., 5.])
In [4]: a
Out[4]: array([1., 2., 3., 4., 5.])
What I am pointing out is not whether __iadd__ returns a value, but whether it is appropriate to express the return value as self+=value. At least in the Python language, return self+=value is not syntactically correct.
Issue with current documentation:
https://numpy.org/devdocs/reference/generated/numpy.ndarray.__iadd__.html
In the documentation for in-place operations (
__iadd__
,__isub__
, etc.), it states "Return self+=value." However, an in-place operation (self+=value
) is a statement, not an expression, so it does not have a return value.Idea or request for content:
The description should be
same as self+=value
,perform self+=value
or something similar.The text was updated successfully, but these errors were encountered: