My C-application is loading the python interpreter dll and calling the function list = PyList_New(len)
to create a new python list of 'len' size.
Two questions:
1. What happens if I call PyList_Append(list, item)
more than len
times? I assume it should throw an exception. Is my understanding correct?
2. More importantly, my second question is whether there is a way to resize the list? I looked at the C APIs at: https://docs.python.org/2/c-api/list.html#c.PyList_SetItem, but could not find such an API. Any suggestions/comments/workaround?
The context of my question is that I need to create the list much earlier than when the list items and the count of them is known.