[Numpy-discussion] Changing np.ravel's return to be same array type as input array

Garrett Reynolds garrettreynolds5 at gmail.com
Sun Dec 28 00:56:47 EST 2014

I made a pull request to change np.ravel so that it would return the same
array type (ndarray, matrix, masked array, etc.) as it took in.

This would bring np.ravel in line with other functions.  For example,
np.sort, np.clip, np.cumsum, np.conjugate, np.partition, np.reshape,
np.transpose, etc.  all return the same array type as they take in.  In
addition, np.diag and np.diagonal were recently changed in PR #5358 to
return the same array type they take in.  Now, np.ravel may be the only
outstanding function with the surprising behavior of always returning an

The concern is that *this could break the code of np.matrix users*, so
@jaimefrio suggested I post here to get some feedback.

You can see more comments on the PR:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141228/ea221bb2/attachment.html>

More information about the NumPy-Discussion mailing list