[SciPy-dev] Problem solved ---- Sorry!

Fernando Pérez fperez at pizero.colorado.edu
Wed Jan 30 13:12:45 CST 2002

On Wed, 30 Jan 2002, eric wrote:

> code = """     
>        return_val = Py::new_reference_to(Py::Int(a+b+c+d));
>        """
> weave.inline(code,['a','b','c','d'])
> weave.inline(code,['b','c','d','e'])
> In the second version, are the argument names substituted positionally or
> by name?  If we go with positional, then the idea of the C/C++ code being
> a continuation of the python code is "broken", and this becomes more of a
> function call.

I hope you're not considering 'going positional'. It would make weave's use
very unnatural and bizarre, IMHO. The way it currently works seems perfectly
natural and logical to me (hopefully it's not that confusing to others once
they realize how to use it once).

> Eventually, I'd like to remove the need to specify the argument list.  
> This would require some C/C++ parsing of the code string to find the
> necessary arguments.

Please follow this route *only* if you can be positive that it's really solid.
It sounds tricky to make it really robust and a fair bit of work, and the
'inconvenience' it addresses seems reasonably minor to me. I also kind of like
the fact that the argumnent list gives me a known interface between the two
layers of code, so if I care to define an 'i' counter in C even if I had one
in Python, it's not a problem. I don't know, maybe others feel differently but
from the possible areas for weave to improve (and where your time and effort
can go), to me this one doesn't really feel that critical.



More information about the Scipy-dev mailing list