On Sat, 28 Dec 2019 19:31:33 +1100 Chris Angelico <[email protected]> wrote: > On Sat, Dec 28, 2019 at 7:03 PM Steve Barnes <[email protected]> wrote: > > > > Personally I still like the fundamental: > > > > > > > > def is_nan(num): > > > > “”” Test for NaN “”” > > > > return num != num > > > > Which was in Steven's original post, and which is dangerous because a > signalling nan will bomb. There's no easy way to get a safe True/False > about whether it's nan or not.
Also, it could be inefficient on types which have an expensive __eq__ and didn't implement an identity shortcut. Regards Antoine. _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/FCCPOFGQS7CDDEWTWR6LMQR2NT5J7GT4/ Code of Conduct: http://python.org/psf/codeofconduct/
