[Numpy-discussion] new NEP: np.AbstractArray and np.asabstractarray
Nathaniel Smith
njs at pobox.com
Fri Mar 9 20:45:20 EST 2018
On Thu, Mar 8, 2018 at 5:51 PM, Juan Nunez-Iglesias <jni.soma at gmail.com> wrote:
>> Finally for the name, what about `asduckarray`? Thought perhaps that could
>> be a source of confusion, and given the gradation of duck array like types.
>
> I suggest that the name should *not* use programmer lingo, so neither
> "abstract" nor "duck" should be in there. My humble proposal is "arraylike".
> (I know that this term has included things like "list-of-list" before but
> only in text, not code, as far as I know.)
I agree with your point about avoiding programmer lingo. My first
draft actually used 'asduckarray', but that's like an in-joke; it
works fine for us, but it's not really something I want teachers to
have to explain on day 1...
Array-like is problematic too though, because we still need a way to
say "thing that can be coerced to an array", which is what array-like
has been used to mean historically. And with the new type hints stuff,
it is actually becoming code. E.g. what should the type hints here be:
asabstractarray(a: X) -> Y
Right now "X" is "ArrayLike", but if we make "Y" be "ArrayLike" then
we'll need to come up with some other name for "X" :-).
Maybe we can call duck arrays "py arrays", since the idea is that they
implement the standard Python array API (but not necessarily the
C-level array API)? np.PyArray, np.aspyarray()?
-n
--
Nathaniel J. Smith -- https://vorpus.org
More information about the NumPy-Discussion
mailing list