09.02.21 12:22, Erlend Aasland пише:
What's the recommended approach with issues like https://bugs.python.org/issue43094? Change the docs or the implementation? I did a quick search on bpo, but could not find similar past issues.
If the documentation and the C implemented function contradict about parameter name, we are free to treat the parameter as positional-only. User cannot pass the argument as keyword because the documented name does not work, and the real name is not exposed to the user. In this case, there are two similar functions, create_function() and create_aggregate(). Both are documented as having parameter "num_params", but real names are different: "narg" and "n_arg". It would be confusing to have different spelling of the same parameter in similar functions. I am sure that it would be difficult to remember how is it spelled in every case. Also, in Python terminology, the semantic of this name is the number of parameters, not the number of argument. So I think that in this particular case the chance of breaking some code is insignificant, but possible long-term harm of exposing bad parameter names may be significant.