I have a question that how to clear a list that's formed by PyList_Append()
?
Is there a document about Python/C extension API functions in detail?
IIRC you have to use PyList_SetSlice
:
PyList_SetSlice(your_list, 0, PyList_Size(your_list), NULL);
You can use the PySequence_DelSlice function:
# The same as: del L[0:len(L)]
PySequence_DelSlice(L, 0, PySequence_Length(L));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With