Hi!
I am confused with Numpy behavior with its scalar or 0-d arrays objects:
numpy.__version__
'1.0rc2'
a = numpy.array((1,2,3))
b = a[:2]
b += 1
b
array([2, 3])
a
array([2, 3, 3])
type(b)
type 'numpy.ndarray'
To this point all is ok for me: subarrays share (by default) memory
):
else:
return self[index]
Sebastien Bardeau wrote:
One possible solution (there can be more) is using ndarray:
In [47]: a=numpy.array([1,2,3], dtype=i4)
In [48]: n=1# the position that you want to share
In [49]: b=numpy.ndarray(buffer=a[n:n+1], shape=(), dtype=i4