Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #86958

Is nan in (nan,) correct?

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 <random832@fastmail.us>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.67.1425594415.21433.python-list@python.org> (permalink)
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

Show key headers only | View raw


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?

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Is nan in (nan,) correct? random832@fastmail.us - 2015-03-05 17:26 -0500
  Re: Is nan in (nan,) correct? sohcahtoa82@gmail.com - 2015-03-05 15:11 -0800
    Re: Is nan in (nan,) correct? Ben Finney <ben+python@benfinney.id.au> - 2015-03-06 10:20 +1100
      Re: Is nan in (nan,) correct? sohcahtoa82@gmail.com - 2015-03-05 15:27 -0800
        Re: Is nan in (nan,) correct? Ben Finney <ben+python@benfinney.id.au> - 2015-03-06 10:39 +1100
        Re: Is nan in (nan,) correct? Chris Angelico <rosuav@gmail.com> - 2015-03-06 10:40 +1100
    Re: Is nan in (nan,) correct? Chris Angelico <rosuav@gmail.com> - 2015-03-06 10:25 +1100
  Re: Is nan in (nan,) correct? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-06 13:09 +1100
    Re: Is nan in (nan,) correct? Ben Finney <ben+python@benfinney.id.au> - 2015-03-06 13:55 +1100
    Re: Is nan in (nan,) correct? Ethan Furman <ethan@stoneleaf.us> - 2015-03-05 19:18 -0800
    Re: Is nan in (nan,) correct? Ben Finney <ben+python@benfinney.id.au> - 2015-03-06 14:26 +1100
    Re: Is nan in (nan,) correct? Ethan Furman <ethan@stoneleaf.us> - 2015-03-05 19:44 -0800
    Re: Is nan in (nan,) correct? Chris Angelico <rosuav@gmail.com> - 2015-03-06 14:49 +1100
    Re: Is nan in (nan,) correct? random832@fastmail.us - 2015-03-05 23:37 -0500
      Re: Is nan in (nan,) correct? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-07 04:07 +1100
    Re: Is nan in (nan,) correct? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-06 04:46 +0000
  Re: Is nan in (nan,) correct? Rustom Mody <rustompmody@gmail.com> - 2015-03-06 01:50 -0800
    Re: Is nan in (nan,) correct? Chris Angelico <rosuav@gmail.com> - 2015-03-06 21:01 +1100
      Re: Is nan in (nan,) correct? Rustom Mody <rustompmody@gmail.com> - 2015-03-06 02:22 -0800
        Re: Is nan in (nan,) correct? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-07 03:59 +1100
          Re: Is nan in (nan,) correct? Rustom Mody <rustompmody@gmail.com> - 2015-03-06 10:04 -0800
            Re: Is nan in (nan,) correct? Ethan Furman <ethan@stoneleaf.us> - 2015-03-06 10:16 -0800
      Re: Is nan in (nan,) correct? Grant Edwards <invalid@invalid.invalid> - 2015-03-06 15:34 +0000
    Re: Is nan in (nan,) correct? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-07 03:43 +1100
      Re: Is nan in (nan,) correct? Rustom Mody <rustompmody@gmail.com> - 2015-03-06 09:04 -0800
        Re: Is nan in (nan,) correct? Chris Angelico <rosuav@gmail.com> - 2015-03-07 04:16 +1100
          Re: Is nan in (nan,) correct? Rustom Mody <rustompmody@gmail.com> - 2015-03-06 09:36 -0800
        Re: Is nan in (nan,) correct? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-07 10:33 +1100
          Re: Is nan in (nan,) correct? Rustom Mody <rustompmody@gmail.com> - 2015-03-06 18:37 -0800

csiph-web