[Python-Dev] PyList API missing PyList_Pop() and PyList_Delete
Raymond Hettinger
python at rcn.com
Fri Oct 24 14:12:57 EDT 2003
> > 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:
>> Well, there's always PyEval_CallMethod...
I ended-up using:
PyObject_CallMethod(to->outbasket, "pop", NULL);
The bummer is that this call is effectively used in a loop and runs once
for every data element in an iterable. Something like pop() has such a
tiny granularity that its runtime is overwhelmed by the lookup time to
call it this way. For this reason, I think PyList_Pop() warrants
inclusion in the API much more than low granularity methods like
PyList_Reverse() or PyList_Sort().
Raymond Hettinger
More information about the Python-Dev
mailing list