Skip to content

Doc warnings #14699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/release/upcoming_changes/14510.compatibility.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
`numpy.lib.recfunctions.drop_fields` can no longer return `None`
----------------------------------------------------------------
`numpy.lib.recfunctions.drop_fields` can no longer return None
--------------------------------------------------------------
If ``drop_fields`` is used to drop all fields, previously the array would
be completely discarded and `None` returned. Now it returns an array of the
be completely discarded and None returned. Now it returns an array of the
same shape as the input, but with no fields. The old behavior can be retained
with::

dropped_arr = drop_fields(arr, ['a', 'b'])
if dropped_arr.dtype.names == ():
dropped_arr = None

converting the empty recarray to `None`
converting the empty recarray to None
14 changes: 7 additions & 7 deletions doc/source/reference/arrays.classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ NumPy provides several hooks that classes can customize:
.. versionadded:: 1.13

Any class, ndarray subclass or not, can define this method or set it to
:obj:`None` in order to override the behavior of NumPy's ufuncs. This works
None in order to override the behavior of NumPy's ufuncs. This works
quite similarly to Python's ``__mul__`` and other binary operation routines.

- *ufunc* is the ufunc object that was called.
Expand Down Expand Up @@ -94,13 +94,13 @@ NumPy provides several hooks that classes can customize:
:class:`ndarray` handles binary operations like ``arr + obj`` and ``arr
< obj`` when ``arr`` is an :class:`ndarray` and ``obj`` is an instance
of a custom class. There are two possibilities. If
``obj.__array_ufunc__`` is present and not :obj:`None`, then
``obj.__array_ufunc__`` is present and not None, then
``ndarray.__add__`` and friends will delegate to the ufunc machinery,
meaning that ``arr + obj`` becomes ``np.add(arr, obj)``, and then
:func:`~numpy.add` invokes ``obj.__array_ufunc__``. This is useful if you
want to define an object that acts like an array.

Alternatively, if ``obj.__array_ufunc__`` is set to :obj:`None`, then as a
Alternatively, if ``obj.__array_ufunc__`` is set to None, then as a
special case, special methods like ``ndarray.__add__`` will notice this
and *unconditionally* raise :exc:`TypeError`. This is useful if you want to
create objects that interact with arrays via binary operations, but
Expand Down Expand Up @@ -135,7 +135,7 @@ NumPy provides several hooks that classes can customize:
place rather than separately by the ufunc machinery and by the binary
operation rules (which gives preference to special methods of
subclasses; the alternative way to enforce a one-place only hierarchy,
of setting :func:`__array_ufunc__` to :obj:`None`, would seem very
of setting :func:`__array_ufunc__` to None, would seem very
unexpected and thus confusing, as then the subclass would not work at
all with ufuncs).
- :class:`ndarray` defines its own :func:`__array_ufunc__`, which,
Expand Down Expand Up @@ -280,7 +280,7 @@ NumPy provides several hooks that classes can customize:

.. py:method:: class.__array_prepare__(array, context=None)

At the beginning of every :ref:`ufunc <ufuncs.output-type>`, this
At the beginning of every :ref:`ufunc <ufuncs-output-type>`, this
method is called on the input object with the highest array
priority, or the output object if one was specified. The output
array is passed in and whatever is returned is passed to the ufunc.
Expand All @@ -295,7 +295,7 @@ NumPy provides several hooks that classes can customize:

.. py:method:: class.__array_wrap__(array, context=None)

At the end of every :ref:`ufunc <ufuncs.output-type>`, this method
At the end of every :ref:`ufunc <ufuncs-output-type>`, this method
is called on the input object with the highest array priority, or
the output object if one was specified. The ufunc-computed array
is passed in and whatever is returned is passed to the user.
Expand All @@ -322,7 +322,7 @@ NumPy provides several hooks that classes can customize:

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

Expand Down
4 changes: 2 additions & 2 deletions doc/source/reference/arrays.dtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ What can be converted to a data-type object is described below:

Used as-is.

:const:`None`
None

.. index::
triple: dtype; construction; from None
Expand Down Expand Up @@ -392,7 +392,7 @@ Type strings
their values must each be lists of the same length as the *names*
and *formats* lists. The *offsets* value is a list of byte offsets
(limited to `ctypes.c_int`) for each field, while the *titles* value is a
list of titles for each field (:const:`None` can be used if no title is
list of titles for each field (None can be used if no title is
desired for that field). The *titles* can be any :class:`string`
or :class:`unicode` object and will add another entry to the
fields dictionary keyed by the title and referencing the same
Expand Down
16 changes: 8 additions & 8 deletions doc/source/reference/arrays.interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,48 +138,48 @@ This approach to the interface consists of the object having an
This attribute can also be an object exposing the
:c:func:`buffer interface <PyObject_AsCharBuffer>` which
will be used to share the data. If this key is not present (or
returns :class:`None`), then memory sharing will be done
returns None), then memory sharing will be done
through the buffer interface of the object itself. In this
case, the offset key can be used to indicate the start of the
buffer. A reference to the object exposing the array interface
must be stored by the new object if the memory area is to be
secured.

**Default**: :const:`None`
**Default**: None

**strides** (optional)

Either :const:`None` to indicate a C-style contiguous array or
Either None to indicate a C-style contiguous array or
a Tuple of strides which provides the number of bytes needed
to jump to the next array element in the corresponding
dimension. Each entry must be an integer (a Python
:const:`int` or :const:`long`). As with shape, the values may
be larger than can be represented by a C "int" or "long"; the
calling code should handle this appropriately, either by
raising an error, or by using :c:type:`Py_LONG_LONG` in C. The
default is :const:`None` which implies a C-style contiguous
default is None which implies a C-style contiguous
memory buffer. In this model, the last dimension of the array
varies the fastest. For example, the default strides tuple
for an object whose array entries are 8 bytes long and whose
shape is (10,20,30) would be (4800, 240, 8)

**Default**: :const:`None` (C-style contiguous)
**Default**: None (C-style contiguous)

**mask** (optional)

:const:`None` or an object exposing the array interface. All
None or an object exposing the array interface. All
elements of the mask array should be interpreted only as true
or not true indicating which elements of this array are valid.
The shape of this object should be `"broadcastable"
<arrays.broadcasting.broadcastable>` to the shape of the
original array.

**Default**: :const:`None` (All array values are valid)
**Default**: None (All array values are valid)

**offset** (optional)

An integer offset into the array data region. This can only be
used when data is :const:`None` or returns a :class:`buffer`
used when data is None or returns a :class:`buffer`
object.

**Default**: 0.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/reference/arrays.ndarray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ Item selection and manipulation
-------------------------------

For array methods that take an *axis* keyword, it defaults to
:const:`None`. If axis is *None*, then the array is treated as a 1-D
*None*. If axis is *None*, then the array is treated as a 1-D
array. Any other value for *axis* represents the dimension along which
the operation should proceed.

Expand Down
Loading