Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Operator Precedence/Boolean Logic Date: Sun, 17 Jul 2016 00:26:19 +1000 Lines: 30 Message-ID: References: <15997174-44d5-431c-8f90-a8d700921820@googlegroups.com> <576b8a41$0$2792$c3e8da3$76491128@news.astraweb.com> <576B9B33.2030903@rece.vub.ac.be> <07e13a5d-38bf-7bfa-f45f-a24dea8e3004@online.de> <576ba927$0$1504$c3e8da3$5496439d@news.astraweb.com> <87wplgfdb5.fsf@elektro.pacujo.net> <4c257ef7-519f-4121-b63b-fb38566072d0@googlegroups.com> <5773c832$0$1598$c3e8da3$5496439d@news.astraweb.com> <57745c6d$0$1583$c3e8da3$5496439d@news.astraweb.com> <5775555f$0$22140$c3e8da3$5496439d@news.astraweb.com> <7ecde6d0-d3db-4a7a-8de6-65b398fedafe@googlegroups.com> <578a0992$0$1610$c3e8da3$5496439d@news.astraweb.com> <578a1436$0$1601$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 5WIXRMd81O7nljc674tiGgwC6ufG7fqF7Sgn4f/s2dEw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; '16,': 0.03; 'api': 0.09; 'cc:addr:python-list': 0.09; 'bug': 0.10; 'times,': 0.13; 'value.': 0.15; '2016': 0.16; 'bug,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'all,': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'delta': 0.22; 'demonstrate': 0.23; 'sat,': 0.23; 'implemented': 0.24; 'header:In-Reply-To:1': 0.24; 'sense': 0.26; 'chris': 0.26; 'equivalent': 0.27; 'message- id:@mail.gmail.com': 0.27; 'bad.': 0.29; 'subject:/': 0.30; 'anyone': 0.32; 'point': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'values.': 0.33; 'received:google.com': 0.35; 'false': 0.35; 'happened': 0.35; 'but': 0.36; 'possible': 0.36; '(and': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'being': 0.37; 'difference': 0.38; 'wrong': 0.38; 'does': 0.39; 'still': 0.40; 'default': 0.61; 'show': 0.62; 'real': 0.62; 'between': 0.65; "they're": 0.66; 'jul': 0.72; '9:02': 0.84; 'chrisa': 0.84; 'to:none': 0.91; 'qualitative': 0.91; 'stood': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=RTzaQKbijFRktoMVQQ5W38o1+Qy751C/RKKPgm9xI2M=; b=eC9/eWLHdqcEt8bhKsLx+q4WIKNMuVrOxLorE34TF9vzlAkDwEdpJEP039YTlvWHcQ NuBU7H3f/1IcIdOiGKFJpB+rj/M0wAPg+2knD6vOhtPwA7SrHqPZlo9cTyO8dJN9Igm3 HVrr0B6oNSXYS3V3kSMLE1SMVMPluB6BAzWaUGfgOwNnzOxYgsxsVeJkwe+HJY/kAWUH 3sm4aOdWWCES4IkxHJ0D50ifAWpzY918Ca8yEy0cMpoJeW1yeu4GXBeRcCsF3Ps6svLH D47w74/nhqRdRhUoNHrTdrqVSMgKCOEUsHUI4LP/ppXHhEninQx/MqH86jrU47D3J/To XvbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=RTzaQKbijFRktoMVQQ5W38o1+Qy751C/RKKPgm9xI2M=; b=O95IxCRBux2MO9W9y2Urj3d0N001mkKZ+cxUz/jQP3Z/zqOSR6I0yEB9VlwRho+kTV sEWHGdpq0VhtdB2tFTSRKK5zkiysLdZfFINlA/oNs0wGfSF4CU94qFI7X0GMjf5Hz+wA ofbfwxfgT/39BMq6geHyT/P+JQNpGb2wSuNyjnTjPWP/dx8d4lDV8GlEyAx5IDev6hDS gpa1UEcdZLhlxfBE/DkWe7gCCOpk7EONlANoOFb5x79j6GuGHILlaNpC3wrwPFYyHtwr /zrXsQhjnlm8cXfyHwqMnatpM2UdSpCFs4pHZEwLnvvwOrUMMeBdDoOQhnZmEsevJSZK Kx9Q== X-Gm-Message-State: ALyK8tJs3HJqu+w0gH9ugBL1iuEVLX+6tosRvH96I0RLgVbVlk8DR6t5rU/pSuOUfrAGjLz4GSm7lkNHSR4Gww== X-Received: by 10.194.117.72 with SMTP id kc8mr4875955wjb.30.1468679180715; Sat, 16 Jul 2016 07:26:20 -0700 (PDT) In-Reply-To: <578a1436$0$1601$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <15997174-44d5-431c-8f90-a8d700921820@googlegroups.com> <576b8a41$0$2792$c3e8da3$76491128@news.astraweb.com> <576B9B33.2030903@rece.vub.ac.be> <07e13a5d-38bf-7bfa-f45f-a24dea8e3004@online.de> <576ba927$0$1504$c3e8da3$5496439d@news.astraweb.com> <87wplgfdb5.fsf@elektro.pacujo.net> <4c257ef7-519f-4121-b63b-fb38566072d0@googlegroups.com> <5773c832$0$1598$c3e8da3$5496439d@news.astraweb.com> <57745c6d$0$1583$c3e8da3$5496439d@news.astraweb.com> <5775555f$0$22140$c3e8da3$5496439d@news.astraweb.com> <7ecde6d0-d3db-4a7a-8de6-65b398fedafe@googlegroups.com> <578a0992$0$1610$c3e8da3$5496439d@news.astraweb.com> <578a1436$0$1601$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:111514 On Sat, Jul 16, 2016 at 9:02 PM, Steven D'Aprano wrote: > On Sat, 16 Jul 2016 08:46 pm, Chris Angelico wrote: > >> As Steven says, >> the default is that they're all truthy, and onus is on the implementer >> to demonstrate that this object is functionally equivalent to 0 or an >> empty collection. (And it's possible for ANYONE to get that wrong - cf >> timedelta.) > > I think you're thinking of time values, not timedelta values. Until > recently, midnight was considered falsey just because it happened to be > implemented as 0 seconds: > > [steve@ando ~]$ python3.3 -c "import datetime;print(bool(datetime.time(0)))" > False > [steve@ando ~]$ python3.6 -c "import datetime;print(bool(datetime.time(0)))" > True > > That was a real bug, letting the concrete implementation show through into > the abstract API by accident, but it's corrected now. > > timedelta values, being a difference between two times, have a qualitative > difference between delta = 0 and every other value. A difference of zero is > no difference at all, and it makes sense to make that falsey. Umm, yes. That's the one. Time, not timedelta. My bad. Point still stands, though - the concept of "midnight" does not truly equate to "empty" or "zero", and that bug stood for a long time. ChrisA