[Numpy-discussion] Keep __array_function__ unexposed by default for 1.17?
Marten van Kerkwijk
m.h.vankerkwijk at gmail.com
Tue May 21 21:30:37 EDT 2019
For 1.17, there has been a big effort, especially by Stephan, to make
__array_function__ sufficiently usable that it can be exposed. I think this
is great, and still like the idea very much, but its impact on the numpy
code base has gotten so big in the most recent PR (gh-13585) that I wonder
if we shouldn't reconsider the approach, and at least for 1.17 stick with
the status quo. Since that seems to be a bigger question than can be
usefully addressed in the PR, I thought I would raise it here.
Specifically, now not only does every numpy function have its dispatcher
function, but also internally all numpy function calls are being done via
the new `__skip_array_function__` attribute, to avoid further overrides. I
think both changes make the code significantly less readable, thus, e.g.,
making it even harder than it is already to attract new contributors.
I think with this it is probably time to step back and check whether the
implementation is in fact the right one. For instance, among the
alternatives we originally considered was one that had the overridable
versions of functions in the regular `numpy` namespace, and the once that
would not themselves check in a different one. Alternatively, for some of
the benefits provided by `__skip_array_function__`, there was a different
suggestion to have a special return value, of `NotImplementedButCoercible`.
Might these be better after all?
More generally, I think we're suffering from the fact that several of us
seem to have rather different final goals in mind In particular, I'd like
to move to a state where as much of the code as possible makes use of the
simplest possible implementation, with only a few true base functions, so
that all but those simplest functions will generally work on any type of
array. Others, however, worry much more about making implementations (even
more) part of the API.
All the best,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion