Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid variadic functions #12

Open
encukou opened this issue Oct 9, 2023 · 2 comments
Open

Avoid variadic functions #12

encukou opened this issue Oct 9, 2023 · 2 comments
Labels
guideline To be included in guidelines PEP

Comments

@encukou
Copy link

encukou commented Oct 9, 2023

Avoid variadic functions. The feature isn't available in all languages that want to use the C-API.

(Per #4, these are fine as alternatives to functions with a fixed number of arguments.)

@encukou encukou added the guideline To be included in guidelines PEP label Oct 11, 2023
@pitrou
Copy link

pitrou commented Oct 14, 2023

This guideline is too strict IMHO. Rather, it should be:

For every variadic function in the C API, there should be a corresponding non-variadic function.

For example PyObject *PyTuple_Pack(Py_ssize_t n, ...) should also have a counterpart PyObject *PyTuple_PackArray(Py_ssize_t n, PyObject**).

@encukou
Copy link
Author

encukou commented Oct 17, 2023

Yes, this guideline relies on the general exception mechanism in #4.
(IMO, if PyTuple_Pack was being added today, it should be named PyTuple_VaPack so that the variadic-ness is exposed in the name.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guideline To be included in guidelines PEP
Projects
None yet
Development

No branches or pull requests

2 participants