[Numpy-discussion] order keyword

Charles R Harris charlesr.harris at gmail.com
Tue Sep 5 13:17:09 EDT 2006


On 9/5/06, Charles R Harris <charlesr.harris at gmail.com> wrote:
>
> I am trying to write more document strings for numpy and have a question
> about the order keyword in tostring. The usual allowed values of this
> keyword are "C", "F", or None, but in the tostring method there is also the
> value "Any" which has the same effect as None. I wonder if the "Any"
> shouldn't be removed as None seems to be the preferred form in other
> methods. Also, the default value of order in the tostring method is "C" and
> it seems to me that the principal of least surprise requires None as the
> default so that the order of the array being converted is the default.
>
> Chuck
>
>

What is the actual order of data in memory? Is it always row major?

In [38]: array([[1,2],[3,4]], dtype=int8, order="F").tofile('test.txt',
sep=" ")

In [39]: cat test.txt
1 2 3 4

In [40]: array([[1,2],[3,4]], dtype=int8, order="F").tostring(order="A")
Out[40]: '\x01\x03\x02\x04'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20060905/0f9b40b9/attachment-0001.html>


More information about the NumPy-Discussion mailing list