// Grab a 6 element array as a Python 6-tuple
%typemap(in) const double dircos[6] (double temp[6]) { // temp[6] becomes a local variable
int i;
if (PyTuple_Check($input) /*|| PyList_Check($input)*/) {
if (!PyArg_ParseTuple($input,"dddddd",temp,temp+1,temp+2,temp+3,temp+4,temp+5)) {
PyErr_SetString(PyExc_TypeError,"list must have 6 elements");
return NULL;
}
$1 = &temp[0];
} else {
PyErr_SetString(PyExc_TypeError,"expected a list.");
return NULL;
}
}
我检查了源代码,发现它实际上检查了
tuple
。这个信息是误导性的。在您需要传递一个元组:
^{pr2}$相关问题 更多 >
编程相关推荐