On Dec 3, 2009, at 4:51 AM, Stefan Behnel wrote:

>
> Dag Sverre Seljebotn, 03.12.2009 12:45:
>>>>> cdef double f(): ...
>>>>> x = f() # infer x as double
>>>
>> This is now http://trac.cython.org/cython_trac/ticket/460.
>
> Note that I closed ticket 236, so you can now call a Python method  
> on a
> corresponding C type, as in
>
>    cdef int i = 1
>    print i.__add__(1)
>    print i.bit_length() # Py3.1
>
> It's implemented through coercion to a Python object. If we find an
> important use case where this isn't fast enough (after all, this is  
> a very
> rare use case anyway), we can always add a specific handler in  
> Optimize.py.
> As this didn't work at all before, I don't expect it to break code  
> either
> (although I had to fix one test case that tested for the original  
> error...)

Nice. With that, I can't see any place that inference of doubles  
wouldn't be safe either, and it would be very convenient.

- Robert


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

Reply via email to