Skip to content

Mark optional parameters as keyword-only #278

@lars-reimann

Description

@lars-reimann

Is your feature request related to a problem?

At the moment, changing the order of parameters is always a breaking change. Likewise, we can only add optional parameters at the end of the list.

Desired solution

In most cases (like for transformers & models), we should mark optional parameters as keyword only. Example:

def f(positional, *, keyword_only = 1)

Now callers of the function must pass the parameter keyword_only by keyword only, i.e. f(1, keyword_only = 2) is allowed but f(1, 2) is not.

This rule should also be added to the guidelines.

Possible alternatives (optional)

No response

Screenshots (optional)

No response

Additional Context (optional)

Related to #273.

Metadata

Metadata

Assignees

Labels

documentation 📖Improvements or additions to documentationreleasedIncluded in a release

Type

No type

Projects

Status

✔️ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions