question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extend __numpy_ufunc__ to most numpy.core.multiarray functions?

See original GitHub issue

The __numpy_ufunc__ mechanism likely is easily extended to all relevant numpy.core.multiarray functions. This would also enable several pure-Python Numpy functions (e.g. hstack, vstack, …) to work transparently with 3rd party classes — as long as array/asarray are not called, things should work out transparently.

It might also make sense to add a helper function to multiarraymodule so that the override mechanism can be invoked from Python side. This could be a sensible alternative e.g. in the case of linear algebra functions.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
mattipcommented, Oct 3, 2018

Can we close this? We have now NEP 18 __array_function__ and NEP 18 duck arrays

0reactions
mhvkcommented, Oct 3, 2018

Agreed, closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NEP 43 — Enhancing the extensibility of UFuncs - NumPy
This NEP outlines how NumPy will operate on arrays with custom dtypes in the future. The most important functions operating on NumPy arrays...
Read more >
Writing your own ufunc — NumPy v1.23 Manual
It provides a great many examples of how to create a universal function. ... Details explaining the Python-C API can be found under...
Read more >
How to extend NumPy
Each entry in the mymethods array is a PyMethodDef structure containing 1) the Python name, 2) the C-function that implements the function, 3)...
Read more >
The N-dimensional array (ndarray) — NumPy v1.24 Manual
An array object represents a multidimensional, homogeneous array of fixed-size items. Indexing arrays#. Arrays can be indexed using an extended Python slicing ...
Read more >
NEP 5 — Generalized Universal Functions - NumPy
Each ufunc consists of an elementary function that performs the most basic operation on the smallest portion of array arguments (e.g. adding two...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found