I am using SWIG to access C++ code from Python. How do I elegantly wrap a function that returns values in variables passed by reference like
void set(double&a) {
a = 42.;
}
I could not find out how to do this. In the best case I'd be able to use the function in Python with Python floats:
>>> b = 2.
>>> set(b)
>>> print b
42.0
At the moment it gives me a TypeError: in method 'TestDouble_set', argument 2 of type 'double &'
.
cpointer.i
provided by SWIG, but it is than rather cumbersome. – Lunseth