x1 = np.empty(5).fill(2)
x1 is None
True
x1 = np.empty(5)
x1.fill(2)
x1
array([2., 2., 2., 2., 2.])
np.empty function, which generates an array with uninitialized values, of the given size. This function should only be used when the initialization of all elements can be guaranteed by other means, such as an explicit loop over the array elements or another explicit assignment.