summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2014-07-29 22:57:12 +0200
committerJulian Taylor <jtaylor.debian@googlemail.com>2014-07-29 23:43:21 +0200
commit2acbfa7a38961e4e52c6cdb4735079cc8e4d842b (patch)
tree6eb69abee000cb3700c040f22d33fb72a0d1075e /doc
parent97bf5a73e98b816aacad6ad57a7b508a3de23947 (diff)
downloadnumpy-2acbfa7a38961e4e52c6cdb4735079cc8e4d842b.tar.gz
MAINT: disable ufunc override for 1.9 release
The ufunc override `__numpy_ufunc__` still has a few unresolved issues regarding its behavior towards Python operators see gh-4815. To avoid releasing numpy with an interface that might change in the next numpy version and to not further delay the 1.9 release it has been decided to disable the feature in 1.9.0.
Diffstat (limited to 'doc')
-rw-r--r--doc/release/1.9.0-notes.rst9
-rw-r--r--doc/source/reference/arrays.classes.rst70
2 files changed, 0 insertions, 79 deletions
diff --git a/doc/release/1.9.0-notes.rst b/doc/release/1.9.0-notes.rst
index e6bedcdf8..37343ec6d 100644
--- a/doc/release/1.9.0-notes.rst
+++ b/doc/release/1.9.0-notes.rst
@@ -6,8 +6,6 @@ This release supports Python 2.6 - 2.7 and 3.2 - 3.4.
Highlights
==========
-* Addition of `__numpy_ufunc__` to allow overriding ufuncs in ndarray
- subclasses.
* Numerous performance improvements in various areas, most notably indexing and
operations on small arrays are significantly faster.
Indexing operations now also release the GIL.
@@ -269,13 +267,6 @@ ufunc reductions do since 1.7. One can now say axis=(index, index) to pick a
list of axes for the reduction. The ``keepdims`` keyword argument was also
added to allow convenient broadcasting to arrays of the original shape.
-Ufunc and Dot Overrides
-~~~~~~~~~~~~~~~~~~~~~~~
-For better compatibility with external objects you can now override
-universal functions (ufuncs), ``numpy.core._dotblas.dot``, and
-``numpy.core.multiarray.dot`` (the numpy.dot functions). By defining a
-``__numpy_ufunc__`` method.
-
Dtype parameter added to ``np.linspace`` and ``np.logspace``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The returned data type from the ``linspace`` and ``logspace`` functions can
diff --git a/doc/source/reference/arrays.classes.rst b/doc/source/reference/arrays.classes.rst
index 036185782..2b97bc309 100644
--- a/doc/source/reference/arrays.classes.rst
+++ b/doc/source/reference/arrays.classes.rst
@@ -39,76 +39,6 @@ Special attributes and methods
Numpy provides several hooks that classes can customize:
-.. function:: class.__numpy_ufunc__(self, ufunc, method, i, inputs, **kwargs)
-
- .. versionadded:: 1.9
-
- Any class (ndarray subclass or not) can define this method to
- override 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.
- - *method* is a string indicating which Ufunc method was called
- (one of ``"__call__"``, ``"reduce"``, ``"reduceat"``,
- ``"accumulate"``, ``"outer"``, ``"inner"``).
- - *i* is the index of *self* in *inputs*.
- - *inputs* is a tuple of the input arguments to the ``ufunc``
- - *kwargs* is a dictionary containing the optional input arguments
- of the ufunc. The ``out`` argument is always contained in
- *kwargs*, if given. See the discussion in :ref:`ufuncs` for
- details.
-
- The method should return either the result of the operation, or
- :obj:`NotImplemented` if the operation requested is not
- implemented.
-
- If one of the arguments has a :func:`__numpy_ufunc__` method, it is
- executed *instead* of the ufunc. If more than one of the input
- arguments implements :func:`__numpy_ufunc__`, they are tried in the
- order: subclasses before superclasses, otherwise left to right. The
- first routine returning something else than :obj:`NotImplemented`
- determines the result. If all of the :func:`__numpy_ufunc__`
- operations return :obj:`NotImplemented`, a :exc:`TypeError` is
- raised.
-
- If an :class:`ndarray` subclass defines the :func:`__numpy_ufunc__`
- method, this disables the :func:`__array_wrap__`,
- :func:`__array_prepare__`, :data:`__array_priority__` mechanism
- described below.
-
- .. note:: In addition to ufuncs, :func:`__numpy_ufunc__` also
- overrides the behavior of :func:`numpy.dot` even though it is
- not an Ufunc.
-
- .. note:: If you also define right-hand binary operator override
- methods (such as ``__rmul__``) or comparison operations (such as
- ``__gt__``) in your class, they take precedence over the
- :func:`__numpy_ufunc__` mechanism when resolving results of
- binary operations (such as ``ndarray_obj * your_obj``).
-
- The technical special case is: ``ndarray.__mul__`` returns
- ``NotImplemented`` if the other object is *not* a subclass of
- :class:`ndarray`, and defines both ``__numpy_ufunc__`` and
- ``__rmul__``. Similar exception applies for the other operations
- than multiplication.
-
- In such a case, when computing a binary operation such as
- ``ndarray_obj * your_obj``, your ``__numpy_ufunc__`` method
- *will not* be called. Instead, the execution passes on to your
- right-hand ``__rmul__`` operation, as per standard Python
- operator override rules.
-
- Similar special case applies to *in-place operations*: If you
- define ``__rmul__``, then ``ndarray_obj *= your_obj`` *will not*
- call your ``__numpy_ufunc__`` implementation. Instead, the
- default Python behavior ``ndarray_obj = ndarray_obj * your_obj``
- occurs.
-
- Note that the above discussion applies only to Python's builtin
- binary operation mechanism. ``np.multiply(ndarray_obj,
- your_obj)`` always calls only your ``__numpy_ufunc__``, as
- expected.
-
.. function:: class.__array_finalize__(self)
This method is called whenever the system internally allocates a