Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:134': 0.05; 'true,': 0.05; 'testing,': 0.09; 'python': 0.11; 'suggest': 0.14; 'accepts': 0.16; 'boolean': 0.16; 'stats': 0.16; 'tighter': 0.16; 'true:': 0.16; 'language': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'seems': 0.21; 'header:User-Agent:1': 0.23; 'fairly': 0.24; "i've": 0.25; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'specifically': 0.29; 'testing': 0.29; 'chris': 0.29; 'am,': 0.29; 'that.': 0.31; 'usually': 0.31; 'equality': 0.31; 'anyone': 0.31; 'checking': 0.33; 'there,': 0.34; 'something': 0.35; 'but': 0.35; 'false': 0.36; 'done': 0.36; 'doing': 0.36; 'should': 0.36; 'list.': 0.37; 'same.': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'above,': 0.60; 'real': 0.63; 'different': 0.65; 'mar': 0.68; 'truth': 0.81; 'pardon': 0.84; 'hill': 0.95 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EAD4oF1OGuA9G/2dsb2JhbABRCcUjgSyDGQEBAQMBeAYLCxgJFg8JAwIBAgEPNhMGAgKHYQMJCMZ5DVeGHxeMPIE6YhaEIgSWUIFthjOGMIVIgy4 Date: Wed, 05 Mar 2014 14:37:15 +0100 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20131103 Icedove/17.0.10 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Reference References: <53144e8d$0$2149$426a74cc@news.free.fr> <1d1dfa1b-b715-4d8f-9c12-f0d3dc1a22c9@googlegroups.com> <85ppm3httu.fsf@benfinney.id.au> <20140303155112.46e34ff8@bigbox.christie.dr> <87siqy7whs.fsf@elektro.pacujo.net> <53155c15$0$2923$c3e8da3$76491128@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394026653 news.xs4all.nl 2840 [2001:888:2000:d::a6]:55668 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67846 Op 04-03-14 16:25, Chris Angelico schreef: > On Wed, Mar 5, 2014 at 2:19 AM, Jerry Hill wrote: >> Out of curiosity, do you think we should be doing truth checking with >> 'is'? True and False are singletons, and it seems to me that the >> justification for idenity versus equality should be just as strong >> there, but I don't think I've ever seen anyone even suggest that. > Normal truth testing is done like this: > > if cond: In an other language with real booleans where an if only accepts a boolean that would be true. In python this is testing for "something." > This isn't truth testing, this is checking the identity of what's in cond: > > if cond is True: > > And that's specifically testing for something much tighter than > truthiness. As you can see from my stats above, that's actually fairly > rare. Usually you'd just accept that True, 1, "yes", [1,2,3], and > 1.2345 are all equally true. No I usually don't accept that. A number different from 0 is not the same as a none-empty list. I usally don't want to treat them the same. -- Antoon Pardon