And to eliminate the order kwarg, use functools.partial to patch the zeros function (or any others, as needed):
In [26]: import numpy as np In [27]: from functools import partial In [28]: np.zeros = partial(np.zeros, order="F") In [29]: x = np.zeros((2,3), dtype=np.int32) In [30]: y = x + 1 In [31]: x.strides Out[31]: (4, 8) In [32]: y.strides Out[32]: (4, 8) In [33]: np.__version__ Out[33]: '1.9.2' Bryan > On Aug 2, 2015, at 3:22 PM, Sturla Molden <sturla.mol...@gmail.com> wrote: > > On 02/08/15 22:14, Kang Wang wrote: >> Thank you all for replying! >> >> I did a quick test, using python 2.6.6, and the original numpy package >> on my Linux computer without any change. >> == >> x = np.zeros((2,3),dtype=np.int32,order='F') >> print "x.strides =" >> print x.strides >> >> y = x + 1 >> print "y.strides =" >> print y.strides >> == >> >> Output: >> -------- >> x.strides = >> (4, 8) >> y.strides = >> (12, 4) >> -------- > > Update NumPy. This is the behavior I talked about that has changed. > > Now NumPy does this: > > > In [21]: x = np.zeros((2,3),dtype=np.int32,order='F') > > In [22]: y = x + 1 > > In [24]: x.strides > Out[24]: (4, 8) > > In [25]: y.strides > Out[25]: (4, 8) > > > > Sturla > > > > > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion