On Sun, Jun 20, 2021, 2:07 PM Sebastian Berg > NumPy has: > > * `flatten()` (always copy) > * `ravel()` (copies if needed, and additionally ensures contiguity) > * `reshape(-1)` (copies if needed) > > They are all subtly different, unfortunately. >
Oops! Sebastian is right, and I made an error. NumPy ndarray.flatten() is indeed a copy. ndarray.ravel() is usually a view.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/FNVCLMSUY47Y7SGBIPIERLIZQCNFO7KU/ Code of Conduct: http://python.org/psf/codeofconduct/