On 2019-06-18 15:42, Victor Stinner wrote:
I don't think that it's a good idea. It would require too many functions for all combinations. Like passing an argument as keyword, handling methods, etc. Why only 2? Why not up to 5? :-)
By that argument, we shouldn't have added PyObject_CallNoArgs() either. I think that supporting OneArgs and TwoArgs is a reasonable compromise.
And yes, I also want to do the same thing for methods (PyObject_CallMethodObjNoArgs, ...).
If you want efficient function calls, use Cython which should use the most efficient available API ;-)
I'm talking about code internal to CPython, where using Cython is unfortunately not an option.