Message374373
Add a `clamp` function to the `math` module which does something like this:
```py
def clamp(value=0.5, minimum=0, maximum=1):
"""Clamps the *value* between the *minimum* and *maximum* and returns it..
<And some extra explanatory documentation with examples>
"""
return max(minimum, min(value, maximum))
```
Because even `C++` has built-in clamp function (`std::clamp`) (which can be used using `#include <math.h>`) |
|
Date |
User |
Action |
Args |
2020-07-27 12:28:33 | SFM61319 | set | recipients:
+ SFM61319 |
2020-07-27 12:28:33 | SFM61319 | set | messageid: <1595852913.43.0.233033170193.issue41408@roundup.psfhosted.org> |
2020-07-27 12:28:33 | SFM61319 | link | issue41408 messages |
2020-07-27 12:28:33 | SFM61319 | create | |
|