[Python-ideas] Consider adding clip or clamp function to math

Xavier Combelle xavier.combelle at gmail.com
Wed Aug 10 02:46:43 EDT 2016


I just stumble upon on this precise use case yesterday, I solved it
unsatisfactorily by the following code (inlined)

value = max(lower, value)
value = min(upper, value)

So It's certainly a good thing to have
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160810/a0b234c5/attachment.html>


More information about the Python-ideas mailing list