Re: [Numpy-discussion] A basic question about swig and Numeric

2008-09-25 Thread Russell E. Owen
In article [EMAIL PROTECTED], Michel Dupront [EMAIL PROTECTED] wrote: Hello, I am trying to use Numeric and swig but it seems that there are few points that I don't understand. The only excuse I have is that I am new to these tools. I have a simple example that I cannot make work the

[Numpy-discussion] A basic question about swig and Numeric

2008-09-24 Thread Michel Dupront
Hello, I am trying to use Numeric and swig but it seems that there are few points that I don't understand. The only excuse I have is that I am new to these tools. I have a simple example that I cannot make work the way I would like. I have a c++ function that take as argument a

Re: [Numpy-discussion] A basic question about swig and Numeric

2008-09-24 Thread Lisandro Dalcin
I believe you should look at the SWIG docs and then write a typecheck typemap. Checking foir the type of and array and returning NULL is not fair play for SWIG, nor for Python. Before returning NULL, and exception should be set. For this, SWIG provides some 'SWIG_xxx_fail' macros. Typemaps and

Re: [Numpy-discussion] A basic question about swig and Numeric

2008-09-24 Thread Lisandro Dalcin
Ups! Since I´ve started to use Cython, it seems I´m starting to forget things about SWIG. Mi comments about a typecheck typemaps were a nonsese (they have another pourpose). Look at the SWIG docs, you need to use something like SWIG_arg_fail macro. On Wed, Sep 24, 2008 at 6:48 PM, Lisandro Dalcin

Re: [Numpy-discussion] A basic question about swig and Numeric

2008-09-24 Thread Christopher Barker
Michel Dupront wrote: I have a c++ function that take as argument a std::vector. From python I want to call the c++ function with an array object. For that purpose I want to write a typemap. Have you seen the SWIG typemaps that come with numpy?: ...\site-packages\numpy\doc\swig They are