Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'context': 0.07; 'logic': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'jan': 0.12; 'collections.': 0.16; 'nan': 0.16; 'nans': 0.16; 'nl.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'putting': 0.22; 'header:User-Agent:1': 0.23; 'laws': 0.24; 'least': 0.26; 'defined': 0.27; 'values': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; "d'aprano": 0.31; 'enforce': 0.31; 'steven': 0.31; 'themselves': 0.32; 'equal': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'apply,': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'itself': 0.39; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'skip:n 10': 0.64; 'lack': 0.78; 'subject:For': 0.78; 'received:fios.verizon.net': 0.84; 'treating': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: NaN comparisons - Call For Anecdotes Date: Wed, 09 Jul 2014 00:57:03 -0400 References: <53bc26ca$0$29995$c3e8da3$5496439d@news.astraweb.com> <53bc8861$0$29995$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-71-175-90-87.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <53bc8861$0$29995$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404881857 news.xs4all.nl 2894 [2001:888:2000:d::a6]:34852 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74227 On 7/8/2014 8:10 PM, Steven D'Aprano wrote: > There's no force of law that requires Python to enforce reflexivity on > values where reflexivity does not apply, There are laws of logic that make the lack of reflexivity obnoxious when putting objects in collections. Python evaded the problem, at least for some builtins, by contradicting itself and treating nans as equal to themselves in the context of collections. In 2.x, 'in' was defined in terms of ==, but >>> nan=float('nan') >>> nl = [nan] >>> nan in nl True even though nan != the only member of nl. In 3.x, 'in' was redefined to include 'is' as well as '=='. -- Terry Jan Reedy