2 ms·
> or get the order of arguments wrong There's a simple fix for that, just do keyword argument only everywhere you can. For me the hill I'm willing to die on i
by boxed 3y ago
> or get the order of arguments wrong
There's a simple fix for that, just do keyword argument only everywhere you can.
For me the hill I'm willing to die on is that labeled/named/keyword arguments are absolutely necessary and most of the usefulness of types is in fact just a shitty version of labeled arguments (god help you if you have a function where two or more arguments have the same type!)
- rdedev 3y agoThe small downside to using kwargs is just the extra letters needed to call the function but I can live with that. As for args with the same type, you can use phantom types I guess but I haven't explored it much in python. I'm pretty interested in the dfdx library in rust which can type enforce matrix or vector operations on it's shape. Stuff like that would really help me
- boxed 3y agoIt's an advantage imo. Makes the code more readable, and much more robust against bad refactors.