Not to go off on too much of a tangent, but isn't NaN unorderable? Its greater than nothing, and less than nothing, so you can't even really sort a list with a NaN value in it (..though I'm sure python does sort it by some metric for practical reasons) - it would be impossible to find a NaN with a binary search... it would be impossible to have a NaN in an ordered sequence .... wouldn't it?
-----Original Message----- From: Cameron Simpson <c...@cskk.id.au> Sent: Sunday, August 29, 2021 5:36 PM To: python-ideas@python.org Subject: [Python-ideas] Re: NAN handling in statistics functions On 27Aug2021 15:50, Finn Mason <finnjavie...@gmail.com> wrote: >Perhaps a math.hasnan() function for collections could be implemented >with binary search? > >math.hasnan(seq) Why would a binary search be of use? A staraight sequential scan of the sequence seems the only reliable method. Binary search is for finding a value in an ordered sequence. Cheers, Cameron Simpson <c...@cskk.id.au> _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/22IYUU JRCPCYUIZBXAUHWE6SBPTIHQME/ Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/M6IROKWARQTCVI7TT3WZUD6TN7H3IRNH/ Code of Conduct: http://python.org/psf/codeofconduct/