[issue36788] Add clamp() function to builtins
New submission from TheComet : It would be nice to have a clamp() builtin in addition to min() and max() so one can type e.g. "clamp(value, 2, 5)" instead of having to type "min(max(value, 5), 2)". -- components: Library (Lib) messages: 341358 nosy: TheComet prior
[issue36788] Add clamp() function to builtins
TheComet added the comment: I have implemented it on my branch here: https://github.com/TheComet/cpython/blob/fix-issue-36788/Python/bltinmodule.c It still needs further testing and I haven't leak checked it properly. -- ___ Python tr