<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 27, 2014 at 10:56 PM, Garrett Reynolds <span dir="ltr"><<a href="mailto:garrettreynolds5@gmail.com" target="_blank">garrettreynolds5@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.<br><br>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.<br><br>The concern is that <b>this could break the code of np.matrix users</b>, so @jaimefrio suggested I post here to get some feedback.<br><br>You can see more comments on the PR: <a href="https://github.com/numpy/numpy/pull/5398" target="_blank">https://github.com/numpy/numpy/pull/5398</a> <br></div>
<br></blockquote><div><br></div><div>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.<br><br></div><div>Chuck. <br></div><br></div></div></div>