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

eric eric at scipy.org
Wed Jan 30 11:58:59 CST 2002


Hey Andreas,

> I calld inline with arguments taht were not used in the code...
> That caused the error .... :-(
> 
> Bug or feature? :-)

The way weave is written, it views the C code as a continuation of the Python code, not really a function call, so the same variables are used in both.  There might be a way around it.  It would incur an efficiency hit, though I think very small.  A bigger issue is that it could be confusing.  For example:

a,b,c,d,e = 1,1,1,1,1
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.

Of course the current behavior was confusing to you, so maybe it is 6 one way and half a dozen the other... :)  

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.

If your interested in more of a function calling approach, for now, take a look at weave.ext_tools.  It builds extension functions that are called in the "normal" way.

see ya,
eric



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20020130/4c699791/attachment.html 


More information about the Scipy-dev mailing list