Py_BuildValue vs PyTuple_Pack vs PyTuple_New

Marco Sulla Marco.Sulla.Python at gmail.com
Tue Oct 20 11:05:29 EDT 2020


I read these three C api functions, They are similar, because they all
construct a tuple[1].

IMHO, Py_BuildValue is more simple to use than PyTuple_Pack that is more
simple to use than PyTuple_New.

Where to use one or the other? What's the relative performance of the three
functions?

[1] actually, Py_BuildValue can also return non-tuple objects.


More information about the Python-list mailing list