[Cython] Fused Types

Sturla Molden sturla at molden.no
Tue May 3 16:36:31 CEST 2011


Den 03.05.2011 16:06, skrev Dag Sverre Seljebotn:
>
> Well, if you do something like
>
> ctypedef fused_type(float, double) speed_t
> ctypedef fused_type(float, double) acceleration_t
>
> cdef func(speed_t x, acceleration_t y)
>
> then you get 4 specializations. Each new typedef gives a new 
> polymorphic type.
>
> OTOH, with
>
> ctypedef speed_t acceleration_t
>
> I guess only 2 specializations.
>
> Treating the typedefs in this way is slightly fishy of course. It may 
> hint that "ctypedef" is the wrong way to declare a fused type *shrug*.
>
> To only get the "cross-versions" you'd need something like what you 
> wrote + Pauli's "paired"-suggestion.
>

This is a bloatware generator.

It might not be used right, or it might generate bloat due to small 
mistakes (which will go unnoticed/silent).


Sturla





More information about the cython-devel mailing list