Description
In general, for function calls with many arguments, programmers should add parameter names to make it clear what each argument refers to.
For novice programmers, however, the benefits of this readability technique are not always obvious. Through code reviews, David has often encouraged this practice, but there is also a programmatic way to enforce it.
David himself has left similar comments on my PRs
Using the bare packing operator, a syntax barrier can be used to enforce keyword-only arguments:
def check_errors(
module_name: Union[list[str], str] = "",
config: Union[dict[str, Any], str] = "",
output: Optional[Union[str, IO]] = None,
load_default_config: bool = True,
autoformat: Optional[bool] = False,
on_verify_fail: Literal["log", "raise"] = "log",
) -> PythonTaReporter:
can become
def check_errors(
*,
module_name: Union[list[str], str] = "",
config: Union[dict[str, Any], str] = "",
output: Optional[Union[str, IO]] = None,
load_default_config: bool = True,
autoformat: Optional[bool] = False,
on_verify_fail: Literal["log", "raise"] = "log",
) -> PythonTaReporter:
This would help avoid comments like the ones I received.
If this readability technique is found useful, a PythonTA custom linter could be added to enforce the rule.
Description
In general, for function calls with many arguments, programmers should add parameter names to make it clear what each argument refers to.
For novice programmers, however, the benefits of this readability technique are not always obvious. Through code reviews, David has often encouraged this practice, but there is also a programmatic way to enforce it.
David himself has left similar comments on my PRs
Using the bare packing operator, a syntax barrier can be used to enforce keyword-only arguments:
can become
This would help avoid comments like the ones I received.
If this readability technique is found useful, a PythonTA custom linter could be added to enforce the rule.