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


Groups > comp.lang.python > #74385

Re: Proposal: === and !=== operators

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'plenty': 0.07; 'expectation': 0.09; 'obey': 0.09; 'cc:addr:python-list': 0.11; 'itself.': 0.14; 'comparisons,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'nans': 0.16; 'subject:operators': 0.16; 'wrote:': 0.18; '(not': 0.18; 'have:': 0.19; 'rules': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'laws': 0.24; 'mathematical': 0.24; 'url:02': 0.24; 'cc:2**0': 0.24; 'mention': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'compared': 0.30; 'nature': 0.30; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; "d'aprano": 0.31; 'equality': 0.31; 'idea,': 0.31; 'steven': 0.31; 'url:06': 0.31; 'supposed': 0.32; 'problem': 0.35; 'problem.': 0.35; 'equal': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'thanks': 0.36; 'should': 0.36; 'positive': 0.37; 'two': 0.37; 'rather': 0.38; 'bad': 0.39; 'number,': 0.60; 'numbers': 0.61; "you're": 0.61; 'hear': 0.63; 'real': 0.63; 'such': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'jul': 0.74; 'generous,': 0.84; 'calculus': 0.91; 'subject:Proposal': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=a+84wlJ93j2vzN+C3heFoFcZA6FuOJCYpZ24Hm9EpKw=; b=lY891bHGOkJP9TR7Mvk0FxrFHp2seKIaXhG43vjxpRneWRCgZdVj9Fue4j3T4SR9/k adtmHxV1kDNWRJ9/Sww9XiSGIR+4LAjPq2rPhU17fD3pPwxLKf5CkUsLz2gWKkEwDeFl Lj4ZyK4zwBsu4++jGZDZeHPx5jouju/OrA0uiu3x5q8pKSLocyhaoPmBM1NYTx/HVkzB Tdtke9BVChKGeIKuXZDPIbnRNgly1xfRiEoYqnAT6SY1G+mMaB02uhiyAeF3n1ylClMv Xy6q/HDXmtIe6y+QVBAcyrvQm80eZgR/9zCQsknuS0RSXHCnV9JtFAIsiKd64ib6XMQB cdgQ==
MIME-Version 1.0
X-Received by 10.58.149.170 with SMTP id ub10mr6426608veb.0.1405184085003; Sat, 12 Jul 2014 09:54:45 -0700 (PDT)
In-Reply-To <53c163ba$0$9505$c3e8da3$5496439d@news.astraweb.com>
References <53bce8a3$0$2746$c3e8da3$76491128@news.astraweb.com> <mailman.11675.1404890483.18130.python-list@python.org> <53bd08b4$0$2746$c3e8da3$76491128@news.astraweb.com> <lpr7kv$1sa$1@news.albasani.net> <53c163ba$0$9505$c3e8da3$5496439d@news.astraweb.com>
Date Sun, 13 Jul 2014 02:54:44 +1000
Subject Re: Proposal: === and !=== operators
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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 <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.11777.1405184093.18130.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1405184093 news.xs4all.nl 2833 [2001:888:2000:d::a6]:40197
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74385

Show key headers only | View raw


On Sun, Jul 13, 2014 at 2:35 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> You're not going to hear me arguing that the non-reflexivity of NANs and
> SQL NULL is a bad idea, although some very smart people have:
>
> http://bertrandmeyer.com/2010/02/06/reflexivity-and-other-pillars-of-civilization/
>
> Mathematical equality is reflexive. It is fundamental to the nature of
> numbers and equality that a number is always equal to itself. To the
> degree that floats are supposed to model real numbers, they should obey
> the same laws of real numbers. However, they already fail to obey them,
> so the failure of reflexivity is just one more problem that makes
> floating point such a hard problem. Compared to floating point
> arithmetic, calculus is easy.
>

And there are plenty of other laws of real numbers that floats violate
(or, let's be generous, "approximate to rather than following
perfectly"). For instance, adding two positive (non-zero) numbers
should result in a number which is greater than either, but thanks to
rounding, that's not always true. (Not to mention that "infinity"
isn't a number, but it is a floating-point value.) The problem is not
equality comparisons, the problem is the expectation that the rules of
reals apply to floats.

ChrisA

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


Thread

Proposal: === and !=== operators Steven D'Aprano <steve@pearwood.info> - 2014-07-09 07:00 +0000
  Re: Proposal: === and !=== operators Chris Angelico <rosuav@gmail.com> - 2014-07-09 17:21 +1000
    Re: Proposal: === and !=== operators Steven D'Aprano <steve@pearwood.info> - 2014-07-09 09:17 +0000
      Re: Proposal: === and !=== operators Rustom Mody <rustompmody@gmail.com> - 2014-07-09 09:20 -0700
      Re: Proposal: === and !=== operators Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-09 11:50 -0600
      Re: Proposal: === and !=== operators Cameron Simpson <cs@zip.com.au> - 2014-07-10 09:16 +1000
      Re: Proposal: === and !=== operators Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-07-12 13:54 +0200
        Re: Proposal: === and !=== operators Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-12 16:35 +0000
          Re: Proposal: === and !=== operators Chris Angelico <rosuav@gmail.com> - 2014-07-13 02:54 +1000
            Re: Proposal: === and !=== operators Roy Smith <roy@panix.com> - 2014-07-12 16:39 -0400
          Re: Proposal: === and !=== operators Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-07-12 20:14 +0200
            Re: Proposal: === and !=== operators Chris Angelico <rosuav@gmail.com> - 2014-07-13 09:01 +1000
              Re: Proposal: === and !=== operators Roy Smith <roy@panix.com> - 2014-07-12 19:06 -0400
                Re: Proposal: === and !=== operators Chris Angelico <rosuav@gmail.com> - 2014-07-13 09:15 +1000
            Re: Proposal: === and !=== operators Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-13 04:48 +0000
  Re: Proposal: === and !=== operators Cameron Simpson <cs@zip.com.au> - 2014-07-09 18:17 +1000
    Re: Proposal: === and !=== operators Steven D'Aprano <steve@pearwood.info> - 2014-07-09 09:02 +0000
      Re: Proposal: === and !=== operators Chris Angelico <rosuav@gmail.com> - 2014-07-09 19:23 +1000
  Re: Proposal: === and !=== operators Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-07-09 05:01 -0700
  Re: Proposal: === and !=== operators Roy Smith <roy@panix.com> - 2014-07-09 08:27 -0400
    Re: Proposal: === and !=== operators Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-09 12:48 +0000
      Re: Proposal: === and !=== operators Tim Chase <python.list@tim.thechases.com> - 2014-07-09 13:05 -0500
        Re: Proposal: === and !=== operators Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-10 01:10 +0000
      Re: Proposal: === and !=== operators Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-09 12:31 -0600
      Re: Proposal: === and !=== operators Roy Smith <roy@panix.com> - 2014-07-09 16:47 -0400
  Re: Proposal: === and !=== operators Ethan Furman <ethan@stoneleaf.us> - 2014-07-09 05:43 -0700
  Re: Proposal: === and !=== operators Robert Kern <robert.kern@gmail.com> - 2014-07-09 16:27 +0100
  Re: Proposal: === and !=== operators Alex Burke <alexjeffburke@gmail.com> - 2014-07-10 18:33 +0200
  Re: Proposal: === and !=== operators Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-12 03:30 +0000
    Re: Proposal: === and !=== operators Alan Bawden <alan@scooby-doo.csail.mit.edu> - 2014-07-12 01:07 -0400
      Re: Proposal: === and !=== operators Torsten Bronger <bronger@physik.rwth-aachen.de> - 2014-07-12 08:05 +0200
        Re: Proposal: === and !=== operators Torsten Bronger <bronger@physik.rwth-aachen.de> - 2014-07-12 08:14 +0200
      Re: Proposal: === and !=== operators Chris Angelico <rosuav@gmail.com> - 2014-07-12 16:06 +1000
      Re: Proposal: === and !=== operators Ethan Furman <ethan@stoneleaf.us> - 2014-07-11 23:11 -0700
      Re: Proposal: === and !=== operators Chris Angelico <rosuav@gmail.com> - 2014-07-12 16:39 +1000
        Re: Proposal: === and !=== operators Marko Rauhamaa <marko@pacujo.net> - 2014-07-12 10:06 +0300
      Re: Proposal: === and !=== operators Ethan Furman <ethan@stoneleaf.us> - 2014-07-11 23:53 -0700
      Re: Proposal: === and !=== operators Chris Angelico <rosuav@gmail.com> - 2014-07-12 17:25 +1000
      Re: Proposal: === and !=== operators Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-12 08:33 +0000

csiph-web