On Sat, Dec 27, 2014 at 10:56 PM, Garrett Reynolds < [email protected]> wrote:
> 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 > array. > > 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: > https://github.com/numpy/numpy/pull/5398 > > The changes to np.diag and np.diagonal did break some code, but I think is is the right thing to do. Matrix is a bit of an oddity, in that it fools with the number of dimensions, but I think consistency and preserving other subtypes like units is more important. The change needs to be noted in the 1.10 release notes under compatibility, I haven't checked yet to see if that is already done in the PR. Chuck.
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
