Mastodon hachyterm.io

Today I learned that if you slice a list in Python, the program returns a copy of the list.

But NumPy returns a view, not a copy. That means, that slicing a NumPy array will modify it:

This default behavior is actually quite useful: it means that when we work with large datasets, we can access and process pieces of these datasets without the need to copy the underlying data buffer.

Further Reading