4 ms·
In languages like Python where you can have keyword args (typically with defaults), these options must come after the first argument, e.g. clamp(x, min=0, max=i
by joshvm 9y ago
In languages like Python where you can have keyword args (typically with defaults), these options must come after the first argument, e.g. clamp(x, min=0, max=inf). Then you can do what you like with the order. And often it's good to specify the keyword for your own sanity later, when you have no idea what the third argument to some obscure Numpy call is. Or if you're using something like matplotlib and there are so many kwargs that it's better to specify.
Although in this case min/max probably shouldn't have defaults, I think clamp(min, x, max) would be a bit weird in Python?