adding 'order=' keyword arg to ravel and others

Because writing "arr.ravel('F')" doesn't seem as descriptive as "arr.ravel(order='F')", I wrote this simple patch. I added mention of the order='A' parameter to a few places it is relevant as well. Here's the branch on github: http://github.com/m-paradox/numpy/compare/master...ravel_keyword_arg Could someone review it for me? It also fixes the following ticket: http://projects.scipy.org/numpy/ticket/1581 Thanks, Mark

Tue, 26 Oct 2010 22:05:52 -0700, Mark Wiebe wrote:
Because writing "arr.ravel('F')" doesn't seem as descriptive as "arr.ravel(order='F')", I wrote this simple patch. I added mention of the order='A' parameter to a few places it is relevant as well. Here's the branch on github:
http://github.com/m-paradox/numpy/compare/master...ravel_keyword_arg
Could someone review it for me?
There is the following problem:
import numpy as np x=np.arange(9).reshape(3,3) x.T.flatten() array([0, 3, 6, 1, 4, 7, 2, 5, 8]) x.T.flatten(order=None) array([0, 1, 2, 3, 4, 5, 6, 7, 8])
PyArray_OrderConverter interprets `None` as "A". However, this problem is already there with `reshape`, so this patch looks good to me -- fixing OrderConverter is a separate job. -- Pauli Virtanen

On Wed, Oct 27, 2010 at 2:36 AM, Pauli Virtanen <pav@iki.fi> wrote:
There is the following problem:
import numpy as np x=np.arange(9).reshape(3,3) x.T.flatten() array([0, 3, 6, 1, 4, 7, 2, 5, 8]) x.T.flatten(order=None) array([0, 1, 2, 3, 4, 5, 6, 7, 8])
PyArray_OrderConverter interprets `None` as "A". However, this problem is already there with `reshape`, so this patch looks good to me -- fixing OrderConverter is a separate job.
The name 'A' for 'Any' doesn't seem right to me either -- 'P' for 'Preserve' or 'K' for 'Keep' would make more sense to me. -Mark
participants (2)
-
Mark Wiebe
-
Pauli Virtanen