I have been studying DSA and don't understand how ctypes.py_object works. As of my knowledge it works on concept of pointers to create an array of pointers that will store memory addresses for values to be added in dynamic array.
I have provided my code below:
def __create_array(self, space):
return (space * ctypes.py_object)()
Basically, this function will create an array of pointer objects with memory addresses to store values in array.
ctypes.py_objectrepresents CPyObject*. If you aren’t interfacing with Python C APIs, you don’t need it.