title: Best way to copy C++ buffer to Python
body: <p>When dealing with C extensions with Python, what is the best way to move data from a C++ array or <code>vector</code> into a <code>PyObject</code>/<code>PyList</code> so it can be returned to Python? </p>
  
  <p>The method I am using right now seems a bit clunky. I am looping through each element and calling <code>Py_BuildValue</code> to append values to a <code>PyList</code>. </p>
  
  <p>Is there something similar to <code>memcpy</code>?</p>