Why can I change a global numpy array from inside a function without using a explicit global reference to it?
import numpy as np
def test():
a[0,0,0] = 34
print(a)
a = np.zeros( (3, 2, 4), dtype=np.int)
test()
print(a)
both print() are equal to:
[[[34 0 0 0]
[ 0 0 0 0]]
[[ 0 0 0 0]
[ 0 0 0 0]]
[[ 0 0 0 0]
[ 0 0 0 0]]]
[[[34 0 0 0]
[ 0 0 0 0]]
[[ 0 0 0 0]
[ 0 0 0 0]]
[[ 0 0 0 0]
[ 0 0 0 0]]]
This contradicts what other thread here says.