On 16 February 2010 17:35, Dag Sverre Seljebotn
<[email protected]> wrote:
> Chris Colbert wrote:
>> Hey all,
>>
>> When coding for the scikits.image project, we are making extensive use
>> of Cython. It would be nice to have algorithms that work on multiple
>> datatypes (numpy dtypes) without having to hand code everything. So,
>> i've been toying around with how a simple templating syntax might look.
>>
>> I've thrown this up on pastebin:
>>
>> http://pastebin.com/f1a49143d
>>
>> I would think (but really i have no idea) that this would be possible to
>> have Cython do during cythonization. But I could implement a templating
>> script that does it, just as proof of concept.
>>
>> What do you all think of that?
>
> I'm happy for any effort done in the area in general. But I'm kind of
> lukewarm to actually having your proposal into Cython as it stands. In
> my mind there's two seperate concepts.
>
> 1) String-based templating
> 2) Proper language templates
>
> 2) has been discussed pretty much in the past and is something we really
> want to have in Cython. However it is something closer to C++ templates
> or Java generics and would look quite different from the syntax you propose.
>
> Your syntax is good for string-based templating (which is what you seem
> to propose), however for that I think it is just as well to use a proper
> templating engine and not couple Cython into it at all. I.e. write the
> files using e.g. proper Cheetah templates, then use a script to turn it
> into pyx (i.e. what you propose, but without the prospect of building it
> into Cython, and without (re)inventing yet another templating language).
>

I agree.

> What really lacks is Cython support for a decent build system -- making
> a convention that the ".tpyx" suffix means "run Cheetah on it, then
> Cython, then gcc" should be a ten-liner, not a huge and impossible
> battle with distutils.
>

BTW, IIUC, NumPy has it's own (very basic?) template engine. IIRC, the
convention is to use a .src suffix. And NumPy distutils will handle
the *.pyx.src -> *.pyx automatically...


-- 
Lisandro Dalcin
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to