Understanding the internals of NumPy to avoid unnecessary array copying