This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author SFM61319
Recipients SFM61319
Date 2020-07-27.12:28:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1595852913.43.0.233033170193.issue41408@roundup.psfhosted.org>
In-reply-to
Content
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>`)
History
Date User Action Args
2020-07-27 12:28:33SFM61319setrecipients: + SFM61319
2020-07-27 12:28:33SFM61319setmessageid: <1595852913.43.0.233033170193.issue41408@roundup.psfhosted.org>
2020-07-27 12:28:33SFM61319linkissue41408 messages
2020-07-27 12:28:33SFM61319create