On Sun, Jul 31, 2016 at 7:10 AM, Ian Kelly email@example.com wrote:
On Sun, Jul 31, 2016 at 2:19 AM, Steven D'Aprano firstname.lastname@example.org wrote:
I'm not sure how your version would work with NANs, and I haven't bothered to try it to find out, but I like this version:
py> min(10, float('nan')) 10
Ah, but the original passed the value before the boundary.
py> min(float('nan'), 10) nan py> max(_, 0) nan
So it works, but it's somewhat fragile because it depends on the order of the arguments to min and max.