C Library Function Argument Detection

With pure Python functions, you can pass arguments either in order (e.g. foo(1, 2, 3) ) or by name (e.g. foo(a=1, c=3, b=2) ).

Functions defined in C modules can use any convention . You cannot say range(stop=10, step=2) , and this happens with most, but not all, functions implemented using the C interface.

Is there a way to define an argument that passes the convention to a function from Python?

+8
python cpython
source share
1 answer

This seems to be a mistake: it is simply impossible to say so. Also, the problem is implementation dependent: your code may work (e.g. PyPy), although I cannot confirm this.

The developers on the error page are not sure whether to change the documentation style or implementation, but I get the impression that this is not a problem for them anyway.

+4
source share

All Articles