title: Get single element from a boost::python::object list, for use in python routine
body: <p>I have a c++ boost python object (the boost wrapper on a PyObject *) for a Python list,</p>
  
  <pre><code>  PyObject * pyList = func(...);
    boost::python::object listObj(handle&lt;&gt;(boost::python::borrowed(pyList)));
  </code></pre>
  
  <p>I can verify this is indeed a list by performing operations on it such as</p>
  
  <pre><code>boost::python::object np = import("numpy");
  boost::python::np_difference = np.attr("diff");
  np_difference(listObj);
  for(int i=0; i&lt;len(listObj); i++){                                                                                         
    double value = boost::python::extract&lt;double&gt;(listObj[i]);                                                                              
    cout &lt;&lt; i &lt;&lt; " " &lt;&lt; value &lt;&lt; endl;                                                                                       
  } 
  </code></pre>
  
  <p>Which subtracts the ith element from the i-1 element and creates a new list, each element of which is then extracted and printed to stdout in C++.</p>
  
  <p>What I would like to do is use this listObj with the print function I define as</p>
  
  <pre><code>boost::python::object print = std.attr("print");    
  </code></pre>
  
  <p>But I would just like it to print one of the elements I specify. In python I would just write</p>
  
  <pre><code>print myList[0]
  </code></pre>
  
  <p>as it is simply a python list. But when I try</p>
  
  <pre><code>print(listObj[0]);
  </code></pre>
  
  <p>in c++ with boost python I get</p>
  
  <pre><code>Error in Python: &lt;type 'exceptions.TypeError'&gt;: No to_python (by-value) converter found for C++ type: boost::python::api::proxy&lt;boost::python::api::item_policies&gt;.
  </code></pre>
  
  <p>So how can I access a single element from a python list object and use it in a python call like the print method above (or any other python function that takes a string for input) from within c++?</p>