[issue41408] Add a `clamp` function to the `math` module

2020-07-27 Thread Avinash Maddikonda
Avinash Maddikonda added the comment: Okay, I'm rejecting this issue. But please let me know/contribute if anyone is going to add a clamp function as a built-in method or a math module function. -- ___ Python tracker <https://bugs.python.

[issue41408] Add a `clamp` function to the `math` module

2020-07-27 Thread Avinash Maddikonda
Change by Avinash Maddikonda : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue41408] Add a `clamp` function to the `math` module

2020-07-27 Thread Avinash Maddikonda
Avinash Maddikonda added the comment: So should I delete/reject this now? Because I think it would be more useful than functions like copysign (I mean copysign can be written easily without confusion, but clamp is confusing sometimes as the max function takes minimum and the min of value

[issue41408] Add a `clamp` function to the `math` module

2020-07-27 Thread Avinash Maddikonda
Avinash Maddikonda added the comment: Oh, I didn't know that. But I was thinking of adding it to the math module and not as a built-in method. I mean, it is definitely more useful than copysign, right? -- ___ Python tracker <ht

[issue41408] Add a `clamp` function to the `math` module

2020-07-27 Thread Avinash Maddikonda
New submission from Avinash Maddikonda : 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.. """