[Cython] Too many instantiations with fused type memoryviews
Pauli Virtanen
pav at iki.fi
Sat Mar 22 13:48:13 CET 2014
Hi,
22.03.2014 12:08, Stefan Behnel kirjoitti:
[clip]
>> Re: arguments in the previous thread --- I think it would indeed be
>> better if memoryviews would not invoke cross-product behavior. If
>> scalars work in one way, also arrays should work in the same way.
>
> I'm not a fused types user myself, but it seems to me that it's worth
> changing this behaviour for 0.21 to better match the most common use cases.
> A pull request that implements this certainly won't hurt, if only to get
> real-world feedback on the change.
>
> The work-around for (existing) code that actually wants the cross product
> behaviour for memory views (for whatever reason) would then be (I guess) to
> use two identical typedefs with different names. This sounds acceptable,
> given that the cross product suggests that we are dealing with independent
> (i.e. different) kinds of data anyway.
I think another argument against the cross-product behavior is that
constructs such as
cdef idx_t foo
and
x = <idx_t>y
and
if idx_t is np.int:
# FOO
else:
# BAR
all become ambiguous in the function body, if idx_t is instantiated in
several different ways.
I can take a look at this today...
(Re: Sturla: I *want* a bloatware generator, but a controllable one :)
--
Pauli Virtanen
More information about the cython-devel
mailing list