summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2006-09-05 18:36:49 +0000
committerCharles Harris <charlesr.harris@gmail.com>2006-09-05 18:36:49 +0000
commitfc61d8a7371a2badfc84313482fe482dac4eb7c6 (patch)
treefd1b9dc3406adcd865831c9ef98645a0047faee1 /numpy
parent341e0beb732f769887c7bb37fe01a5170602ee0a (diff)
downloadnumpy-fc61d8a7371a2badfc84313482fe482dac4eb7c6.tar.gz
Docstring for tostring and small formatting change to PyArray_SearchSorted.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/add_newdocs.py20
-rw-r--r--numpy/core/src/multiarraymodule.c3
2 files changed, 18 insertions, 5 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 17ad3e5b8..9fe0377b8 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -1067,7 +1067,8 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('tofile',
If 'sep' is empty this method is equivalent to file.write(a.tostring()). If
'sep' is not empty each data item is converted to the nearest Python type
and formatted using "format"%item. The resulting strings are written to the
- file separated by the contents of 'sep'.
+ file separated by the contents of 'sep'. The data is always written in "C"
+ (row major) order independent of the order of 'a'.
The data produced by this method can be recovered by using the function
fromfile().
@@ -1079,15 +1080,26 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('tolist',
"""a.tolist() -> Array as hierarchical list.
Copy the data portion of the array to a hierarchical python list and return
- that list.
+ that list. Data items are converted to the nearest compatible Python type.
"""))
add_newdoc('numpy.core.multiarray', 'ndarray', ('tostring',
- """a.tostring(order='C') -> binary array data as Python string.
+ """a.tostring(order='C') -> raw copy of array data as a Python string.
- Construct a Python string containing the raw bytes in the array.
+ Keyword arguments:
+ order -- order of the data item in the copy {"C","F","A"} (default "C")
+
+ Construct a Python string containing the raw bytes in the array. The order
+ of the data in arrays with ndim > 1 is specified by the 'order' keyword and
+ this keyword overrides the order of the array. The
+ choices are:
+
+ "C" -- C order (row major)
+ "Fortran" -- Fortran order (column major)
+ "Any" -- Current order of array.
+ None -- Same as "Any"
"""))
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c
index d5e182fd6..7847ad6e4 100644
--- a/numpy/core/src/multiarraymodule.c
+++ b/numpy/core/src/multiarraymodule.c
@@ -2659,7 +2659,8 @@ PyArray_SearchSorted(PyArrayObject *op1, PyObject *op2, NPY_SEARCHKIND which)
NPY_BEGIN_THREADS_DESCR(ap2->descr)
local_search_left(ap1, ap2, ret);
NPY_END_THREADS_DESCR(ap2->descr)
- } else if (which == NPY_SEARCHRIGHT) {
+ }
+ else if (which == NPY_SEARCHRIGHT) {
NPY_BEGIN_THREADS_DESCR(ap2->descr)
local_search_right(ap1, ap2, ret);
NPY_END_THREADS_DESCR(ap2->descr)