What would be the use case for a duck-array to implement __array__ and return a NumPy array? Unless I'm missing something, this seems redundant and one should just use array/asarray functions then. This would also prevent error-handling, what if the developer intentionally wants a NumPy-like array (e.g., the original array passed to the duckarray function) or an exception (instead of coercing to a NumPy array)?
On Mon, Sep 16, 2019 at 9:25 PM Chris Barker <chris.bar...@noaa.gov> wrote: > > > > On Mon, Aug 12, 2019 at 4:02 AM Peter Andreas Entschev <pe...@entschev.com> > wrote: >> >> Apologies for the late reply. I've opened a new PR >> https://github.com/numpy/numpy/pull/14257 with the changes requested > > > thanks! > > I've written a small PR on your PR: > > https://github.com/pentschev/numpy/pull/1 > > Essentially, other than typos and copy editing, I'm suggesting that a > duck-array could choose to implement __array__ if it so chooses -- it should, > of course, return an actual numpy array. > > I think this could be useful, as much code does require an actual numpy > array, and only that class itself knows how best to convert to one. > > -CHB > > -- > > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > chris.bar...@noaa.gov > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@python.org > https://mail.python.org/mailman/listinfo/numpy-discussion _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion