[Cython] Fused Types

Stefan Behnel stefan_ml at behnel.de
Tue May 3 15:51:30 CEST 2011


mark florisson, 03.05.2011 15:17:
> if you have
>
> cdef func(floating x, floating y):
>      ...
>
> you get a "float, float" version, and a "double, double" version, but
> not "float, double" or "double, float".

So, what would you have to do in order to get a "float, double" and 
"double, float" version then? Could you get that with

     ctypedef fused_type(double, float) floating_df
     ctypedef fused_type(float, double) floating_fd

     cdef func(floating_df x, floating_fd y):

?

I assume there's no special casing for floating point types in the 
compiler, is there?

Stefan


More information about the cython-devel mailing list