views and copiesΒΆ

Sometimes, even after five years using NumPy, I have to go with my gut feeling to predict if an operation will trigger a copy in the underlying data. – NumPy developer

When NumPy returns an array, it may be the same array (a view) or a new one (a copy).

There’s nothing obvious to tell which you’re getting, but the difference can change how the code behaves. Returning a view is faster because there’s no copying step. But a view is the gift that keeps on giving – if either side changes a cell, it silently changes for both.