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


Groups > comp.lang.python > #32230

Re: a.index(float('nan')) fails

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'exception': 0.03; 'argument': 0.04; 'patterns.': 0.07; 'repeated': 0.07; 'undefined': 0.07; 'python': 0.09; '754': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terry': 0.09; 'itself.': 0.11; "wouldn't": 0.11; 'suggest': 0.11; '(but': 0.15; 'value.': 0.15; '"...': 0.16; 'containers': 0.16; 'did.': 0.16; 'discusses': 0.16; 'equality.': 0.16; 'nan': 0.16; 'nans': 0.16; 'oct': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'standard"': 0.16; 'subject:fails': 0.16; 'unequal': 0.16; 'wrote:': 0.17; 'refers': 0.17; 'thu,': 0.17; 'jan': 0.18; '>>>': 0.18; 'code.': 0.20; 'discussion': 0.20; 'bit': 0.21; 'so.': 0.24; 'url:bugs': 0.24; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; '>>>>': 0.29; 'consequence': 0.29; "d'aprano": 0.29; 'equality': 0.29; 'steven': 0.29; "i'm": 0.29; 'fri,': 0.30; 'lists': 0.31; 'implement': 0.32; 'url:python': 0.32; 'asked': 0.33; 'says': 0.33; 'month,': 0.33; 'to:addr:python-list': 0.33; 'equal': 0.33; 'another': 0.33; 'false': 0.35; 'identity': 0.35; 'returning': 0.35; 'pm,': 0.35; 'there': 0.35; 'received:org': 0.36; 'url:org': 0.36; 'compare': 0.36; 'anything': 0.36; 'should': 0.36; 'does': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'nothing': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'here:': 0.62; 'skip:n 10': 0.63; 'more': 0.63; 'within': 0.64; 'behavior': 0.64; 'identity.': 0.65; 'afraid': 0.66; 'ago.': 0.66; 'believe': 0.69; 'disagreement': 0.84; 'everything,': 0.84; 'received:fios.verizon.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: a.index(float('nan')) fails
Date Fri, 26 Oct 2012 14:49:51 -0400
References <bd80bfd0-b423-418f-a338-fea626d50093@googlegroups.com> <mailman.2873.1351217113.27098.python-list@python.org> <5089f915$0$29984$c3e8da3$5496439d@news.astraweb.com> <mailman.2885.1351238073.27098.python-list@python.org> <508aab92$0$29967$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-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0
In-Reply-To <508aab92$0$29967$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 <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2901.1351277411.27098.python-list@python.org> (permalink)
Lines 60
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351277411 news.xs4all.nl 6884 [2001:888:2000:d::a6]:50564
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32230

Show key headers only | View raw


On 10/26/2012 11:26 AM, Steven D'Aprano wrote:
> On Fri, 26 Oct 2012 03:54:02 -0400, Terry Reedy wrote:
>
>> On 10/25/2012 10:44 PM, Steven D'Aprano wrote:
>>> On Thu, 25 Oct 2012 22:04:52 -0400, Terry Reedy wrote:
>>>
>>>> It is a consequence of the following, which some people (but not all)
>>>> believe is mandated by the IEEE standard.
>>>>
>>>>    >>> nan = float('nan')
>>>>    >>> nan is nan
>>>> True
>>>
>>> The IEEE 754 standard says nothing about object identity. It only
>>> discusses value equality.
>>>
>>>>    >>> nan == nan
>>>> False
>>>
>>> IEEE 754 states that all NANs compare unequal to everything, including
>>> NANs with the same bit value. It doesn't make an exception for
>>> comparisons with itself.
>>>
>>> I'm not entirely sure why you suggest that there is an argument about
>>> what IEEE 754 says about NANs.
>>
>> I did not do so.
>
> I'm afraid you did. Your quote is shown above, and repeated here:

The quote precedes and refers to Python code.

>
> "... some people (but not all) believe is mandated by the IEEE standard"
>
> This suggests that there is a disagreement -- an argument -- about what
> the IEEE standard mandates about NANs.

Disagreement about what Python should do has been expressed on the lists 
and even on the tracker. There was one discussion on python-ideas within 
the last month, another a year or so ago.

Python does not implement the full IEEE standard with signalling and 
non-signalling nans and multiple bit patterns.

When a nan is put in a Python collection, it is in effect treated as if 
it were equal to itself.
See the discussion in http://bugs.python.org/issue4296
including "I'm not sure that Python should be asked to guarantee
anything more than "b == b" returning False when b is
a NaN.  It wouldn't seem unreasonable to consider
behavior of nans in containers (sets, lists, dicts)
as undefined when it comes to equality and identity
checks."



-- 
Terry Jan Reedy

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


Thread

a.index(float('nan')) fails mamboknave@gmail.com - 2012-10-25 18:46 -0700
  Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-25 22:04 -0400
    Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 02:44 +0000
      Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-26 03:54 -0400
        Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 15:26 +0000
          Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-26 14:49 -0400
    Re: a.index(float('nan')) fails Nobody <nobody@nowhere.com> - 2012-10-27 17:40 +0100
  Re: a.index(float('nan')) fails Cameron Simpson <cs@zip.com.au> - 2012-10-26 13:15 +1100
    Re: a.index(float('nan')) fails mamboknave@gmail.com - 2012-10-25 19:22 -0700
    Re: a.index(float('nan')) fails mamboknave@gmail.com - 2012-10-25 19:22 -0700
  Re: a.index(float('nan')) fails MRAB <python@mrabarnett.plus.com> - 2012-10-26 03:19 +0100
  Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 02:33 +0000
    Re: a.index(float('nan')) fails Ethan Furman <ethan@stoneleaf.us> - 2012-10-28 06:07 -0700
  Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-26 04:00 -0400
    Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 16:23 +0000
      Re: a.index(float('nan')) fails MRAB <python@mrabarnett.plus.com> - 2012-10-26 17:43 +0100
      Re: a.index(float('nan')) fails Chris Angelico <rosuav@gmail.com> - 2012-10-27 03:45 +1100
        Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 18:40 +0000
          Re: a.index(float('nan')) fails Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-10-26 15:17 -0400
          Re: a.index(float('nan')) fails Chris Angelico <rosuav@gmail.com> - 2012-10-27 12:29 +1100
      Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-26 14:58 -0400
      Re: a.index(float('nan')) fails Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-10-27 00:48 -0400
        Re: a.index(float('nan')) fails Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-10-27 08:56 +0200
          Re: a.index(float('nan')) fails Nobody <nobody@nowhere.com> - 2012-10-27 17:45 +0100
          Re: a.index(float('nan')) fails Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-10-27 13:07 -0400
  Re: a.index(float('nan')) fails Mark Adam <dreamingforward@gmail.com> - 2012-10-27 13:33 -0500

csiph-web