Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.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.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'float': 0.07; 'cc:addr :python-list': 0.11; 'python': 0.11; 'display,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'partly': 0.16; 'repr': 0.16; 'rounding': 0.16; 'roy': 0.16; 'subject:operators': 0.16; 'which,': 0.16; 'wrote:': 0.18; 'have:': 0.19; "python's": 0.19; 'rules': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'change,': 0.30; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; '>>>>': 0.31; 'equality': 0.31; 'fine,': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'false': 0.36; 'should': 0.36; 'so,': 0.37; 'changed': 0.39; 'talking': 0.65; 'smith': 0.68; 'jul': 0.74; 'subject:Proposal': 0.91; 'to:none': 0.92; 'differences': 0.93; 'serious': 0.97 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=u1WHEnD95XD7uG7D8H7hY9kG0esfehQ6W71n71gl+lo=; b=V4s7G+JN1aG85Eb6NBWBpmu+tAvZb7YaZZDLgO8lYglxDYkhFjxblNeEnHJLdwutHQ JV2cns4Pno3OWQITyC0y+IiWjOofiXz7mg/2ORXMmXQyTvtFTOa/L0GSFiEofjv8qXko Xt0RwxOFPRSfFe/wOjijD3ojjaM2tbRQNHSOj/5kB6ytDNFb3B6bDiDhhIIsIDb/zrFj akBsJhqcYvU6uwNNVZKW+zq/hpWgUEQBb9RmOa6zFJ56FT2ua8E40Qpq9BEHjELwRNwx UHBZ44Z8jzfPmwhbELSpZd+0UPvcCTN6JiLqTGdlnrHiPEivAVao930jippfYIDHR50s EtMg== MIME-Version: 1.0 X-Received: by 10.52.118.99 with SMTP id kl3mr6433604vdb.18.1405206956513; Sat, 12 Jul 2014 16:15:56 -0700 (PDT) In-Reply-To: References: <53bce8a3$0$2746$c3e8da3$76491128@news.astraweb.com> <53bd08b4$0$2746$c3e8da3$76491128@news.astraweb.com> <53c163ba$0$9505$c3e8da3$5496439d@news.astraweb.com> Date: Sun, 13 Jul 2014 09:15:56 +1000 Subject: Re: Proposal: === and !=== operators From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405206963 news.xs4all.nl 2841 [2001:888:2000:d::a6]:56815 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74392 On Sun, Jul 13, 2014 at 9:06 AM, Roy Smith wrote: > But, you can still have: > >>>> print x > 1.0 >>>> print y > 1.0 >>>> print x == y > False > > > which, I know, isn't really what you were talking about, but it is part > of the general confusion of using floats. This is partly because of the oh-so-handy magic of Python's float reprs, rounding them off. Can you do the same trick in Python 3, where the repr rules changed? If so, I would say this is a potential flaw in the display, although not really a serious one. But in terms of the OP's complaint, this is still fine, as the state must have changed for it to be unequal. If you care about equality differences and NOT about the above change, well, I think I've found your solution: instead of "x == y", you should use "repr(x) == repr(y)" :) ChrisA