On 2/9/21 9:15 PM, Serhiy Storchaka wrote:
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.
It is. Python will correct you if you try to use the documented name:
import sqlite3 connection = sqlite3.connect(':memory:') connection.create_function('testfunc', num_params=1, func=lambda
arg: None) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: function missing required argument 'narg' (pos 2)