Current Problem
When using the mathematical function put() with a scalar index, a .resize() is required, like this:
modified_array = put(old_array, index.resize(1), new_value.resize(1))
Proposed Solution
It would be nice if scalar values were accepted for the indices and values arguments.
Alternatives Considered
If it's too hard or costs too much performance, documenting this case in the API reference would be helpful.
Additional context
Numpy does accept scalars in the corresponding function:
arr = np.arange(5)
np.put(arr, 0, 5)
print(arr)
# Outputs [5 1 2 3 4]
Current Problem
When using the mathematical function
put()with a scalar index, a.resize()is required, like this:Proposed Solution
It would be nice if scalar values were accepted for the
indicesandvaluesarguments.Alternatives Considered
If it's too hard or costs too much performance, documenting this case in the API reference would be helpful.
Additional context
Numpy does accept scalars in the corresponding function: