GenericMappingTools / GenericMappingTools/pygmt

Improve function signatures to use positional-only, positional-or-keyword, or keyword-only parameter

Open
#2,893 0 comments 0 reactions 0 assignees View on GitHub
discussions
Dominant language
Python
Stars
874
Forks
255
Avg merge
1d 21h
Merged PRs (30d)
40

Description

Previously mentioned in many places:

- https://github.com/GenericMappingTools/pygmt/pull/2726#discussion_r1359805008
- https://github.com/GenericMappingTools/pygmt/pull/731#discussion_r825477816
- https://github.com/GenericMappingTools/pygmt/pull/1282#issuecomment-846599504

Related PEPs:

- https://peps.python.org/pep-0457/
- https://peps.python.org/pep-0570/
- https://peps.python.org/pep-3102/

In short, the new function definition will be like:
```
def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):
----------- ---------- ----------
| | |
| Positional or keyword |
| - Keyword only
-- Positional only
```

Note: Enable ruff's [flake8-boolean-trap (FBT)](https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt) after finishing this request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.