
July 31, 2016
1:14 p.m.
On Sun, Jul 31, 2016 at 7:10 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
On Sun, Jul 31, 2016 at 2:19 AM, Steven D'Aprano <steve@pearwood.info> 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:
Answer:
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.