On Tue, Jun 18, 2019 at 7:19 AM Jeroen Demeyer <J.Demeyer@ugent.be> wrote:
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.
I think Victor's point is why 1 positional argument and two positional arguments? Why not 1 keyword argument? Or 1 positional and 1 keyword argument?
How hard would it be to analyze the cpython repo and see how common the various ways of calling code is? That way we can pragmatically just see what would be the most useful and not guess (my gut backs up Jeroen, although I would name it PyObject_OnePositionalArg() or something to be more explicit).
-Brett
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.
capi-sig mailing list -- capi-sig@python.org To unsubscribe send an email to capi-sig-leave@python.org