'why is numpy array defaulted to global?

I find it strange that the following program passes a numpy array around like a global variable even though I have not defined it to be global inside a def:

import numpy as np

a = np.zeros([5])

a[:] = np.array([1,2,3,4,5])
print("outside a is ",a)
def func1():
    print("func1: a is ",a)
func1()
def func2():
    a[2] = a[2]*2
    print("func2: a is ",a)
func2()
print("outside a is ",a)

What am I missing here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source