Feature or enhancement
Suggesting to add syntax for producing deprecation warnings for positional use of optional parameters.
I made a proof-of-concept patch for this where I introduced a new special symbol x. Example use:
/*[clinic input]
mod.func
stuff: object
/
x
optarg: int = 128
This will then generate code that emits a DeprecationWarning if optarg is passed as a positional argument, but not if it is passed as a keyword.
We can use this feature to introduce deprecation warnings for parameters that will become keyword-only in future releases. When the deprecation period is done, we can simply replace the x with *, to really make the optional params keyword-only.
Pitch
Quoting @serhiy-storchaka, in issue #93057:
It is recommended to make optional rarely used arguments keyword-only. I do not think it will break much code, but we need a deprecation period for this.
The problem is that sqlite3.connect() was converted to Argument Clinic, and it was much easier to add deprecation warning in the old code.
Previous discussion
Linked PRs
Feature or enhancement
Suggesting to add syntax for producing deprecation warnings for positional use of optional parameters.
I made a proof-of-concept patch for this where I introduced a new special symbol
x. Example use:This will then generate code that emits a DeprecationWarning if
optargis passed as a positional argument, but not if it is passed as a keyword.We can use this feature to introduce deprecation warnings for parameters that will become keyword-only in future releases. When the deprecation period is done, we can simply replace the
xwith*, to really make the optional params keyword-only.Pitch
Quoting @serhiy-storchaka, in issue #93057:
Previous discussion
Linked PRs