[Pyrex] C versus Python access
Robert Bradshaw
robertwb at math.washington.edu
Thu Nov 1 23:43:39 CET 2007
On Nov 1, 2007, at 3:24 PM, Greg Ewing wrote:
> Robert Bradshaw wrote:
>> I ended up making a global flag that you can
>> set right before calling when you want it to skip the dispatching
>> code.
>
> Well, I guess that works, but it's pretty ugly. There's
> zero chance of this feature getting into Pyrex if a better
> solution can't be found.
It turned out to not be as ugly as I had expected, but there should
be cleaner ways. The absolute cleanest way would be to have a single
function with multiple entry points--not something offered by c
(well, any hack to do so in c would be *really* ugly).
There are other ways I thought of doing it, but all involve an extra
(c) function call. As we are using this for our arithmetic model, I
want to avoid even sacrificing that much on speed.
generated_def_function(self, ...):
foo_c(self, ...)
generated_cdef_function(self, ...):
[dispatch code]
foo_c(self, ....)
foo_c(self, ...):
[the actual body]
One would have to call foo_c directly on unbound c methods too.
- Robert
More information about the Pyrex
mailing list