[Numpy-discussion] Why ndarray provides four ways to flatten?

Alexander Belopolsky ndarray at mac.com
Mon Oct 27 20:06:49 EDT 2014


Given an n-dim array x, I can do

1. x.flat
2. x.flatten()
3. x.ravel()
4. x.reshape(-1)

Each of these expressions returns a flat version of x with some
variations.  Why does NumPy implement four different ways to do essentially
the same thing?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141027/619c0360/attachment.html>


More information about the NumPy-Discussion mailing list