title: How to pass a tuple from Python 3.6 to C++
body: <p>Small issue with full embedded <code>Python</code> and <code>C++</code>. The question is that I have a <code>Python</code> code that will return a tuple, aka in this case the statement is:</p>
  
  <pre><code>def test():
     x = 1;
     y=2;
     c=3;
     d=4;
     return [x,y,c,d]
  </code></pre>
  
  <p>In <code>C++</code>, I have embedded the code in the following fashion:</p>
  
  <pre><code>pValue = PyObject_CallObject(pFunc, pArgs);
  Py_DECREF(pArgs);
  if (pValue != NULL)
  {
      printf("Result of call: %d\n", PyTuple_GetItem(pArgs, i, pValue));
  }
  </code></pre>
  
  <p>For some reason, printed output is something like this:</p>
  
  <p>Result of call: <code>1846660304</code></p>
  
  <p>Tried also returning a string, this did not work either. Only one that worked was returning for example return h and the in <code>C++</code> instead of using <code>PyTuple_GetItem</code>, use <code>PyLong_AsLong()</code>.</p>
  
  <p>Can someone please point me to the correct direction in how to read he return values to <code>C++</code>, I'm rather new to <code>Python</code> and unfortunately the <code>Python</code> documentation is on a poor level at least in this case with no code samples or anything whatsoever.</p>