Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'element': 0.07; '*is*': 0.09; 'operator,': 0.09; 'overflow': 0.09; 'received:internal': 0.09; 'used.': 0.09; '"in"': 0.16; 'container.': 0.16; 'dict': 0.16; 'effect,': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'tuples,': 0.16; 'stack': 0.19; 'specify': 0.24; 'question': 0.24; 'testing': 0.29; '(on': 0.31; 'container': 0.31; 'equality': 0.31; 'received:66': 0.35; 'subject: (': 0.35; 'objects': 0.35; 'subject:?': 0.36; 'received:10': 0.37; 'being': 0.38; 'to:addr :python-list': 0.38; 'list,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.63 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:subject:date; s=mesmtp; bh=MWy76cRmbR1b4ybldY/ei+NwKIQ=; b=TaOe2KizWZyySy2jmQrV42LVxHx0 pwpSZjG3c427fJKLD4O8YMs1jsOxJG+2pHT2h+lb2nFeUQDiPMCWPFvhGACSxonR qDtMK6eeoKMAVfKGK2IYcjWYNLavKhqscP6iexyZvhn9COkHtfv8zCyAWxJpj4iY mgaXTnkk5PlZ9TM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:subject :date; s=smtpout; bh=MWy76cRmbR1b4ybldY/ei+NwKIQ=; b=R8vSktaO35g defqDDEiF3xK+LXVOJIXyshj47A1HSzQndz2GoAYWb8YgyeaoTDv3BrfCZmfiIx1 rm7Qx72LKdrwG/8SmGRUUfXGs4a2SfFmlOtnSnQRMSCVHS+2ahT592GuH/SvPeOh 5fWrY3IFmTmZ6nv5XKHP+1/doPQhqfy4= X-Sasl-Enc: 5pJTiyoTuvcYAckXJ2V3X8ddlj4gJ7VgBa6MEH9S6Sud 1425594413 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-07699171 Subject: Is nan in (nan,) correct? Date: Thu, 05 Mar 2015 17:26:53 -0500 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1425594415 news.xs4all.nl 2902 [2001:888:2000:d::a6]:54753 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3804 X-Received-Body-CRC: 2321190436 Xref: csiph.com comp.lang.python:86958 It's been brought up on Stack Overflow that the "in" operator (on tuples, and by my testing on dict and list, as well as dict lookup) uses object identity as a shortcut, and returns true immediately if the object being tested *is* an element of the container. However, the contains operation does not specify whether object identity or equality is to be used. In effect, the built-in container types use a hybrid test: "a is b or a == b". My question is, is this a *correct* implementation of the operator, or are objects "supposed to" use a basis of equality for these tests?