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? :-)
IMHO calling a function without any arguments is common enough to justify PyObject_CallNoArgs(). And it's a single function.
If you want efficient function calls, use Cython which should use the most efficient available API ;-)
Victor
Le mar. 18 juin 2019 à 15:26, Jeroen Demeyer <J.Demeyer@ugent.be> a écrit :
Hello all,
Victor Stinner recently added the function PyObject_CallNoArgs() for calling an object without any arguments, see https://docs.python.org/3.9/c-api/object.html#c.PyObject_CallNoArgs
The next obvious question is: should we have PyObject_CallOneArg(), PyObject_CallTwoArgs()? Of course, this cannot continue forever, so I suggest adding the 1 and 2 argument variants which would cover most use cases. Cython has something like that and it becomes very natural to use these functions.
The main advantage is that we can implement these variants much more efficiently than the existing PyObject_CallFunction() or PyObject_CallFunctionObjArgs().
capi-sig mailing list -- capi-sig@python.org To unsubscribe send an email to capi-sig-leave@python.org
-- Night gathers, and now my watch begins. It shall not end until my death.