[Numpy-discussion] Behavior of array scalars
alexander.belopolsky at gmail.com
Fri Feb 17 12:51:03 CST 2006
On 2/17/06, Christopher Barker <Chris.Barker at noaa.gov> wrote:
> >>> x += 5
> I expect this to change the object in place.
> >>> x
> but what is this? is it no longer an array?
I would say it is a bug, but here is an easy work-around
>>> x = array(5)
You can also use
With an additional benefit that the same syntax works for any shape.
> Is there a way to set the value in place, without resorting to:
>>> x[...] = 10
>>> x[()] = 10
You can see more on this feature at
More information about the Numpy-discussion