title: Python/SWIG: Output an array
body: <p>I am trying to output an array of values from a C function wrapped using SWIG for Python. The way I am trying to do is using the following typemap.</p>
  
  <p>Pseudo code:</p>
  
  <pre><code>int oldmain() {
  float *output = {0,1};
  return output;
  }
  </code></pre>
  
  <p>Typemap:</p>
  
  <pre><code>%typemap(out) float* { 
     int i; 
    $result = PyList_New($1_dim0); 
     for (i = 0; i &lt; $1_dim0; i++) { 
   PyObject *o = PyFloat_FromDouble((double) $1[i]); 
   PyList_SetItem($result,i,o); 
   } 
  } 
  </code></pre>
  
  <p>My code compiles well, but it hangs when I run access this function (with no more ways to debug it).</p>
  
  <p>Any suggestions on where I am going wrong?</p>
  
  <p>Thanks.</p>