On Oct 9, 2009, at 1:58 AM, Dag Sverre Seljebotn wrote:

> Robert Bradshaw wrote:
> I think I figured out a nice way to fix this issue in general
> though...optimize
>
> some_int = int(some_float)
>
> Nice and Pythonic and one doesn't have to bother with casts, types  
> etc.
>
> http://trac.cython.org/cython_trac/ticket/400

Very good point! I see people do int(...) and float(...) all the  
time, and sometimes it's the only Python calls in their inner loops  
(and makes everything else into a Python call as well. Would int(...)  
return a long if it's going to be used in a C context? One issue is  
that I use int(...) when I want an actual Python object, though I'm  
sure we could figure something out.

- Robert

P.S. Defining ssize_t, even as an alias to Py_ssize_t (are they ever  
different?) would still probably be a good idea.

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

Reply via email to