Fri, 29 Apr 2011 12:53:06 +0200, mark florisson wrote:
[clip]
> But if we just allow that for fused types, then couldn't we simply do
> 
> ctypedef cython.fused_type(float, double) real_t
> 
> cdef real_plus_one(real_t complex a):
>     real_t b = a.real
>     return b + 1
> 
> ? Then you don't need to pair anything. Perhaps we could introduce
> real_t as a type, just like numeric and floating. So I guess
> special-casing complex sounds fine with me.

Special-casing for complex sounds ugly to me; "complex float" 
is a type name in the same way as "long int" is, and writing 
"real_t complex" feels a bit like writing "int_t long".

But of course, if this feature is really only needed for declaring
complex variants of real types, then how it is done doesn't matter
so much. But, IMHO, such a special casing would be a somewhat weird
language feature.

-- 
Pauli Virtanen

_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to