Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Argument Clinic: add support for deprecating positional use of parameters #95065

Closed
@erlend-aasland

Description

@erlend-aasland

Feature or enhancement

Suggesting to add syntax for producing deprecation warnings for positional use of optional parameters.

I made aproof-of-concept patch for this where I introduced a new special symbolx. Example use:

/*[clinicinput]mod.funcstuff:object    /xoptarg:int=128

This will then generate code that emits a DeprecationWarning ifoptarg 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 thex 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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp