Refactoring code with new guvectorize features

I’m excited about the upcoming feature in Numba that will allow us to use guvectorize functions within jit or other guvectorize functions. I hope that this feature may be included in release 0.59, perhaps early next year. This is a fantastic addition that will save many lines of code in the future.
Thank you in advance, Numba team! @guilherme

However, there are still some limitations related to default parameters, keyword parameters, and passing native ufunc parameters to inner guvectorize functions. Will these limitations likely persist and what considerations should I keep in mind when adapting my numba codebase?

  • Default Parameters and Keyword Parameters:
    Guvectorize functions currently do not support default parameters or keyword parameters, which can be a challenge when creating flexible functions with optional arguments. Will this limitation persist in future Numba releases, or are there plans to address it?

  • Passing native ufunc parameters to an inner guvectorize function:
    The ability to pass the axis keyword to a guvectorize function and apply it to code designed for one-dimensional problems is incredibly useful. In many cases, I’ll need to pass ufunc native parameters like axis to an inner guvectorize function. How will this functionality work?

What will be the best practices for writing effective and flexible code using guvectorize? Currently, we often need to write wrapper functions to address the described limitations, but with the upcoming features, these wrappers may no longer be necessary in some cases.

I’m eager to hear about the future outlook regarding these limitations and best practices in guvectorize going forward.

Hi @Oyibo,

These limitations will continue to persist. The work I am doing in #8984 only deals with calling @guvectorize functions from @jit.

Hey @guilherme,

Thanks for your response.
I’m excited about the integration of @guvectorize functions within @jit. It is already a big step forward. If we need more flexibility for specific functions we can soon use jitted wrapper functions which we can integrate in other numba code as well.
Good job!