8000 Merge pull request #6035 from charris/documentation-maintenance · njsmith/numpy@7a3926c · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a3926c

Browse files
committed
Merge pull request numpy#6035 from charris/documentation-maintenance
Documentation fixes.
2 parents 61d2a44 + f5e9adb commit 7a3926c

30 files changed

+1642
-1622
lines changed

doc/source/reference/arrays.classes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ Numpy provides several hooks that classes can customize:
147147
The value of this attribute is used to determine what type of
148148
object to return in situations where there is more than one
149149
possibility for the Python type of the returned object. Subclasses
150-
inherit a default value of 1.0 for this attribute.
150+
inherit a default value of 0.0 for this attribute.
151151

152152
.. function:: class.__array__([dtype])
153153

154154
If a class (ndarray subclass or not) having the :func:`__array__`
155155
method is used as the output object of an :ref:`ufunc
156156
<ufuncs.output-type>`, results will be written to the object
157-
returned by :func:`__array__`. Similar conversion is done on
157+
returned by :func:`__array__`. Similar conversion is done on
158158
input arrays.
159159

160160

doc/source/reference/arrays.interface.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The Array Interface
1212

1313
This page describes the numpy-specific API for accessing the contents of
1414
a numpy array from other C extensions. :pep:`3118` --
15-
:cfunc:`The Revised Buffer Protocol <PyObject_GetBuffer>` introduces
15+
:c:func:`The Revised Buffer Protocol <PyObject_GetBuffer>` introduces
1616
similar, standardized API to Python 2.6 and 3.0 for any extension
1717
module to use. Cython__'s buffer array support
1818
uses the :pep:`3118` API; see the `Cython numpy
@@ -67,7 +67,7 @@ This approach to the interface consists of the object having an
6767
could hold (a Python int is a C long). It is up to the code
6868
using this attribute to handle this appropriately; either by
6969
raising an error when overflow is possible, or by using
70-
:cdata:`Py_LONG_LONG` as the C type for the shapes.
70+
:c:data:`Py_LONG_LONG` as the C type for the shapes.
7171

7272
**typestr** (required)
7373

@@ -88,9 +88,9 @@ This approach to the interface consists of the object having an
8888
``u`` Unsigned integer
8989
``f`` Floating point
9090
``c`` Complex floating point
91-
``O`` Object (i.e. the memory contains a pointer to :ctype:`PyObject`)
91+
``O`` Object (i.e. the memory contains a pointer to :c:type:`PyObject`)
9292
``S`` String (fixed-length sequence of char)
93-
``U`` Unicode (fixed-length sequence of :ctype:`Py_UNICODE`)
93+
``U`` Unicode (fixed-length sequence of :c:type:`Py_UNICODE`)
9494
``V`` Other (void \* -- each item is a fixed-size chunk of memory)
9595
===== ================================================================
9696

@@ -134,7 +134,7 @@ This approach to the interface consists of the object having an
134134
means the data area is read-only).
135135

136136
This attribute can also be an object exposing the
137-
:cfunc:`buffer interface <PyObject_AsCharBuffer>` which
137+
:c:func:`buffer interface <PyObject_AsCharBuffer>` which
138138
will be used to share the data. If this key is not present (or
139139
returns :class:`None`), then memory sharing will be done
140140
through the buffer interface of the object itself. In this
@@ -154,7 +154,7 @@ This approach to the interface consists of the object having an
154154
:const:`int` or :const:`long`). As with shape, the values may
155155
be larger than can be represented by a C "int" or "long"; the
156156
calling code should handle this appropiately, either by
157-
raising an error, or by using :ctype:`Py_LONG_LONG` in C. The
157+
raising an error, or by using :c:type:`Py_LONG_LONG` in C. The
158158
default is :const:`None` which implies a C-style contiguous
159159
memory buffer. In this model, the last dimension of the array
160160
varies the fastest. For example, the default strides tuple
@@ -195,13 +195,13 @@ C-struct access
195195
This approach to the array interface allows for faster access to an
196196
array using only one attribute lookup and a well-defined C-structure.
197197

198-
.. cvar:: __array_struct__
198+
.. c:var:: __array_struct__
199199
200-
A :ctype:`PyCObject` whose :cdata:`voidptr` member contains a
201-
pointer to a filled :ctype:`PyArrayInterface` structure. Memory
202-
for the structure is dynamically created and the :ctype:`PyCObject`
200+
A :c:type: `PyCObject` whose :c:data:`voidptr` member contains a
201+
pointer to a filled :c:type:`PyArrayInterface` structure. Memory
202+
for the structure is dynamically created and the :c:type:`PyCObject`
203203
is also created with an appropriate destructor so the retriever of
204-
this attribute simply has to apply :cfunc:`Py_DECREF()` to the
204+
this attribute simply has to apply :c:func:`Py_DECREF()` to the
205205
object returned by this attribute when it is finished. Also,
206206
either the data needs to be copied out, or a reference to the
207207
object exposing this attribute must be held to ensure the data is
@@ -239,12 +239,12 @@ flag is present.
239239
.. admonition:: New since June 16, 2006:
240240

241241
In the past most implementations used the "desc" member of the
242-
:ctype:`PyCObject` itself (do not confuse this with the "descr" member of
243-
the :ctype:`PyArrayInterface` structure above --- they are two separate
242+
:c:type:`PyCObject` itself (do not confuse this with the "descr" member of
243+
the :c:type:`PyArrayInterface` structure above --- they are two separate
244244
things) to hold the pointer to the object exposing the interface.
245245
This is now an explicit part of the interface. Be sure to own a
246-
reference to the object when the :ctype:`PyCObject` is created using
247-
:ctype:`PyCObject_FromVoidPtrAndDesc`.
246+
reference to the object when the :c:type:`PyCObject` is created using
247+
:c:type:`PyCObject_FromVoidPtrAndDesc`.
248248

249249

250250
Type description examples

doc/source/reference/arrays.ndarray.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,14 @@ memory block can be accessed by some combination of the indices.
133133
While a C-style and Fortran-style contiguous array, which has the corresponding
134134
flags set, can be addressed with the above strides, the actual strides may be
135135
different. This can happen in two cases:
136-
1. If ``self.shape[k] == 1`` then for any legal index ``index[k] == 0``.
137-
This means that in the formula for the offset
138-
:math:`n_k = 0` and thus :math:`s_k n_k = 0` and the value of
139-
:math:`s_k` `= self.strides[k]` is arbitrary.
140-
2. If an array has no elements (``self.size == 0``) there is no legal index
141-
and the strides are never used. Any array with no elements may be
142-
considered C-style and Fortran-style contiguous.
136+
137+
1. If ``self.shape[k] == 1`` then for any legal index ``index[k] == 0``.
138+
This means that in the formula for the offset :math:`n_k = 0` and thus
139+
:math:`s_k n_k = 0` and the value of :math:`s_k` `= self.strides[k]` is
140+
arbitrary.
141+
2. If an array has no elements (``self.size == 0``) there is no legal
142+
index and the strides are never used. Any array with no elements may be
143+
considered C-style and Fortran-style contiguous.
143144

144145
Point 1. means that ``self``and ``self.squeeze()`` always have the same
145146
contiguity and :term:`aligned` flags value. This also means that even a high
@@ -238,7 +239,6 @@ Other attributes
238239
ndarray.imag
239240
ndarray.flat
240241
ndarray.ctypes
241-
__array_priority__
242242

243243

244244
.. _arrays.ndarray.array-interface:
@@ -292,7 +292,6 @@ Array conversion
292292
ndarray.item
293293
ndarray.tolist
294294
ndarray.itemset
295-
ndarray.setasflat
296295
ndarray.tostring
297296
ndarray.tobytes
298297
ndarray.tofile

doc/source/reference/arrays.scalars.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ Some of the scalar types are essentially equivalent to fundamental
6565
Python types and therefore inherit from them as well as from the
6666
generic array scalar type:
6767

68-
==================== ====================
68+
==================== ================================
6969
Array scalar type Related Python type
70-
==================== ====================
70+
==================== ================================
7171
:class:`int_` :class:`IntType` (Python 2 only)
7272
:class:`float_` :class:`FloatType`
7373
:class:`complex_` :class:`ComplexType`
7474
:class:`str_` :class:`StringType`
7575
:class:`unicode_` :class:`UnicodeType`
76-
==================== ====================
76+
==================== ================================
7777

7878
The :class:`bool_` data type is very similar to the Python
7979
:class:`BooleanType` but does not inherit from it because Python's
@@ -215,7 +215,7 @@ Attributes
215215
==========
216216

217217
The array scalar objects have an :obj:`array priority
218-
<__array_priority__>` of :cdata:`NPY_SCALAR_PRIORITY`
218+
<__array_priority__>` of :c:data:`NPY_SCALAR_PRIORITY`
219219
(-1,000,000.0). They also do not (yet) have a :attr:`ctypes <ndarray.ctypes>`
220220
attribute. Otherwise, they share the same attributes as arrays:
221221

0 commit comments

Comments
 (0)
0