Was there a reason for leaving this out of the API or should it be added? Is the right way to simulate a pop something like this: n = PyList_GET_SIZE(outbasket); if (n == 0) { PyErr_SetString(PyExc_IndexError, "Pop from an empty list."); return NULL; } result = PyList_Get_Item(outbasket, n-1); if (result == NULL) return NULL; Py_INCREF(result); empty_list = Py_ListNew(0); if (empty_list == NULL) { Py_DECREF(result); return NULL; } err = PyList_SetSlice(to->outbasket, n-1, n, empty_list); Py_DECREF(empty_list); if (err == -1) { Py_DECREF(result); return NULL; } return result; /* Whew, that was a lot of code for a pop have a popped result */ Raymond Hettinger
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4