On Jul 23, 2009, at 11:23 PM, Jason Grout wrote:
> Is it possible to support the any() and all() functions? I'm using
> the
> most recent version of Cython in Sage, so forgive me if it is already
> supported in Cython, but just not in Sage's version yet.
It's working for me...
{{{
%cython
print any([0,0,1,0]), all([0,0,1,0])
///
(True, False)
}}}
> I realize that it probably would be easy to write such functions, but
> since they are standard python functions, it would be nice if they
> were
> recognized by Cython. It would be super nice if they were *fast*
> too :).
This was actually discussed recently, and yes, we'd like to support
this kind of thing. It shouldn't be too hard to do either. However,
it's hard to see how one would get faster than the builtin
implementations of all and any, short of getting rid of the Python call.
For (some) builtlins, it might be interesting to extract and call the
C function pointer directly. This could give a good speedup for
builtins...
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev