Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: 0 equals False, was Re: (unknown) Date: Wed, 23 Mar 2016 14:00:48 -0400 Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de tUzCxZMP+syuNEnVRm2ehgslk1C0hEtP27EtUoa2pUVQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'false,': 0.07; 'discriminate': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.11; '0.0,': 0.16; 'equality.': 0.16; 'pythonic': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'wrote:': 0.16; 'am,': 0.23; 'sets': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'received:96': 0.63; 'between': 0.65; 'otten': 0.84; 'received:fios.verizon.net': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-96-227-207-81.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105563 On 3/23/2016 4:51 AM, Peter Otten wrote: > The pythonic solution is "don't do this". The == operator cannot > discriminate between 0, 0.0, and False, and 0j and Fraction(0, 1) and Decimal(0) > or 1, 1.0, and True and 1+0j, Fraction(1, 1) and Decimal(1) Sets and dicts are based both based on (transitive) equality. -- Terry Jan Reedy