You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a bunch of fields in PyUFuncObject that don't make sense for normal ufuncs (are nulled), and most methods in ufunc_methods don't make sense for gufuncs.
What would seem like a better model for me is the following type heirarchy
base_ufunc
gufunc- actually knows about core_enabled
ufunc - has the reduce, accumulate, and reduce_at methods, and identity property
I'm guessing that both binary and API compatibility in C are important - so maybe this could just change from the python side?
It looks to me like it's far too late in the day to cut up PyUFuncObject into multiple pieces, but I think just letting it be viewed under different python types would be useful for hiding invalid methods and properties
The text was updated successfully, but these errors were encountered:
In addition to the general rule that subclasses are always a bad idea, I
don't understand what this is trying to accomplish. Isn't core_enabled an
internal implementation detail? And reduce and friends aren't meaningful
for ufuncs-but-not-gufuncs, they're (potentially) meaningful for 2-input
(g)ufuncs where the inputs are square and inputs and outputs all have the
same shape. And anyway, shouldn't we be trying to make gufuncs and ufuncs
share more code, not less?
I guess my main concern: Right now, PyUFunc_GenericFunction, which is the main code behind ufuncs, is just a massive switch between "do a ufunc thing" and "do a gufunc thing".
To me, this seems better represented with subclasses.
And anyway, shouldn't we be trying to make gufuncs and ufuncs
share more code, not less?
Yes, you're right. But right now, it's very hard to tell what they share and what they don't.
If you look at the code though, it's a giant copy/paste with a few things changed. I think it would be better to reduce the copy/paste instead of formalizing it?
Uh oh!
There was an error while loading. Please reload this page.
There's a bunch of fields in
PyUFuncObject
that don't make sense for normalufunc
s (are nulled), and most methods inufunc_methods
don't make sense for gufuncs.What would seem like a better model for me is the following type heirarchy
base_ufunc
gufunc
- actually knows aboutcore_enabled
ufunc
- has thereduce
,accumulate
, andreduce_at
methods, andidentity
propertyI'm guessing that both binary and API compatibility in C are important - so maybe this could just change from the python side?
It looks to me like it's far too late in the day to cut up
PyUFuncObject
into multiple pieces, but I think just letting it be viewed under different python types would be useful for hiding invalid methods and propertiesThe text was updated successfully, but these errors were encountered: