3 ms·
I don't use Numpy but it sounds like they're describing *, ** operators. default_args = ('x', 'y', 'z') default_kwargs = {'p': 'p', 'q': 'q', 'r': 'r'}
by PyWoody 4y ago
I don't use Numpy but it sounds like they're describing *, ** operators.
default_args = ('x', 'y', 'z')
default_kwargs = {'p': 'p', 'q': 'q', 'r': 'r'}
def printer(x, y, z, /, *, p, q, r):
print(f'x={x} | y={y} | z={z} | p={p} | q={q} | r={r}')
printer(*default_args, **default_kwargs) # x=x | y=y | z=z | p=p | q=q | r=r
EDIT: Formatting.
- masklinn 4y agoYes but also that lacks most of the documentation so it's not great. If you have multiple callables taking these parameters documenting them is awkward, by default help/pydoc and sphinx will tell you that the parameters are `default_args` and `default_kwargs`, but that's not actually true, those are just intended as shortcuts / helpers .