On 11/3/10 11:47 PM, Brett Calcott wrote:
> If I just had to write one of these functions, then
> indeed trying to do it as a one-liner would be silly. But I'm wrapping
> lots of them, and this means I'm just cutting and pasting code, and
> then replacing names. When I find myself doing that, I think: there
> has to be a better way.

yup. However, it seems to me that the reason you are cutting and pasting 
code is that you have followed a consistent convention in your code 
(convention over configuration, as the Rails people say), which is a 
good thing. However, to me, the alternative to your cutting and pasting 
is not to try to come up with a compact way to express your convention 
in Cython, but rather code-generation.

One day, we may have a mature Cython code generator for wrapping C/C++ 
(and it may be worth looking at what has been done along those lines). 
But in the meantime, you could pretty quickly whip out a code generator 
that works for your particular use-case. Maybe use a general purpose 
template system (Cheetah, for instance) would help?

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to