On Mar 10, 2008, at 3:26 PM, Dag Sverre Seljebotn wrote:

> Getting ideas after posting...
>
> One could also declare known return type of existing ptyhon lib  
> functions like this:
>
> assumetype(cython.types.int, sum)
>
> def foo(arr):
>   s = sum(arr)
>   # s is now  native C int
>
> leading to eliminating all the casts.


I'm not so sure about this--overriding the declared types of builtin  
functions, the non-locality of the declaration (assumetype could be  
anywhere in the file, or imported from somewhere else, but the  
conversion happens inside the function).

- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to