scilus / scilpy

The Sherbrooke Connectivity Imaging Lab (SCIL) Python dMRI processing toolbox
Other
54 stars 59 forks source link

Keyword-only arguments #975

Open CHrlS98 opened 2 months ago

CHrlS98 commented 2 months ago

Keyword-only arguments https://peps.python.org/pep-3102/ could help make the code more robust. Basically, it forces the user to write the keyword for optional keyword arguments when calling a function.

Example Function declaration:

def function(a, b, *, c=something, d=anything)

Function call:

my_a = ...
my_b = ...
my_c = ...
my_d = ...

# valid
out = function(my_a, my_b, c=my_c, d=my_d)

# invalid
out = function(my_a, my_b, my_c, my_d)