[Numpy-discussion] Ufuncs and flexible types, CAPI

Val Kalatsky kalatsky at gmail.com
Sat Dec 31 01:48:10 EST 2011


Hi folks,

First post, may not follow the standards, please bear with me.

Need to define a ufunc that takes care of various type.
Fixed - no problem, userdef - no problem, flexible - problem.
It appears that the standard ufunc loop does not provide means to
deliver the size of variable size items.
Questions and suggestions:

1) Please no laughing: I have to code for NumPy 1.3.0.
Perhaps this issue has been resolved, then the discussion becomes moot.
If so please direct me to the right link.

2) A reasonable approach here would be to use callbacks and to give the
user (read programmer)
a chance to intervene at least twice: OnInit and OnFail (OnFinish may not
be unreasonable as well).

OnInit: before starting the type resolution the user is given a chance to
do something (e.g. check for
that pesky type and take control then return a flag indicating a stop)
before the resolution starts
OnFail: the resolution took place and did not succeed, the user is given a
chance to fix it.
In most of the case these callbacks are NULLs.

I could patch numpy with a generic method that does it, but it's a shame
not to use the good ufunc machine.

Thanks for tips and suggestions.

Val Kalatsky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111231/95ec986f/attachment.html>


More information about the NumPy-Discussion mailing list