title: Swig: Pass a vector<float> from c++ to python
body: <p>I want to write some code in C++ which returns a vector to python. I tried the following example, but it returns the following object.</p>
  
  <pre><code>&lt;Swig Object of type 'std::vector&lt; float &gt; *' at 0x100331f90&gt;
  </code></pre>
  
  <p>How can I convert this to a list so that I can use it in python?</p>
  
  <p>My code:</p>
  
  <pre><code>/* File: example.i */
  %module example
  
  %{
  #define SWIG_FILE_WITH_INIT
  #include "example.h"
  %}
  
  std::vector&lt;float&gt; Test(int n);
  </code></pre>
  
  <p>.</p>
  
  <pre><code>/* File: example.cpp */
  
  #include &lt;vector&gt;
  
  std::vector&lt;float&gt; Test(int n){
  
      std::vector&lt;float&gt; a(4);
      a[1] =  1;
      a[2] = 24234;
      return a;
  }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>/* File: example.h 
  http://www.swig.org/Doc1.3/Python.html#Python_nn4
  */
  
  #include &lt;vector&gt;
  std::vector&lt;float&gt; Test(int n);
  </code></pre>