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: Fri, 24 Jun 2016 01:49:19 +1000 Lines: 20 Message-ID: References: <15997174-44d5-431c-8f90-a8d700921820@googlegroups.com> <56ecacd4-cc17-48ec-9830-57c8113d16f6@googlegroups.com> <576b5ea3$0$1595$c3e8da3$5496439d@news.astraweb.com> <576B96C0.2040106@rece.vub.ac.be> <576bae4c$0$11112$c3e8da3@news.astraweb.com> <576BB841.1080603@rece.vub.ac.be> <576bd818$0$1619$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de ei0LnEwW7++dJVmVGvPmaw51nQIKVA0kLbCv0GIsRsZA== 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; 'bug.': 0.07; 'cc:addr :python-list': 0.09; 'implies': 0.09; "object's": 0.09; 'trees': 0.09; 'bug': 0.10; 'question.': 0.13; 'argument': 0.15; 'thu,': 0.15; '2016': 0.16; '23,': 0.16; 'containers': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'items;': 0.16; 'mismatch': 0.16; 'non-empty': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'to:addr:pearwood.info': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.16; 'pointed': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'least': 0.27; 'message-id:@mail.gmail.com': 0.27; 'subject:/': 0.30; "i'd": 0.31; "d'aprano": 0.33; 'steven': 0.33; 'add': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'ones': 0.35; 'false': 0.35; 'received:74.125.82': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'missing': 0.37; 'your': 0.60; 'back': 0.62; 'between': 0.65; 'chrisa': 0.84; 'pain': 0.84 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:to :cc; bh=Gmevi9VF9Ry76Ekc/PNe7OaqR1Qqb7CplaBeyvblB2g=; b=cFXyzEkacSMcRhKZyCM/9mKRkahoLaBTjyJ29Hl2O9DDJnfv3IKDOr8kji2j27gLU/ Cb9lNhkbSy9IBUpldKT2QT2y/SQyqtVs02YqsXxM7id2pyq8JaA79Qcbg4n7vRZM3XMr 7hpZzx70zIVCxHU4tDdmvaTPPaOvzHKo1VKI4mwrSP9jece4vbD7ULIEejDSy+1QftmH cKf3bFCBp5gmNHUFMCMXD8iL0OiDALrYT9fWuhLZ6lCXDLtlot2KOKYnVnji0FjJa0fW VGU4EFBa1u0rhN+u7ktkVK4WKFT1v6L8J+jw6DDt8ET2mOVcxAgWa1CIRoQLXKlhQ6FZ 9nJA== 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:to:cc; bh=Gmevi9VF9Ry76Ekc/PNe7OaqR1Qqb7CplaBeyvblB2g=; b=SjKMFbByts3JzKbDADV/a1BKPpXurWQLBFw6f7UoafgrkU7HMjRauQrWXPIdNejKD9 jSVqg0LUmyY/265CHXaefb0JWibv+0b0n41qxOtn16Z6CmFwKUzK8dmkD0Ti95NrJ1gG Cmv4TdrUbzRiaW2Zgp5f7Dj81K/3VK4sgQespM831XEBMU24PYlqNYu5Dt8BbmyUWp0d scYgerBkmtjJCNKxCXfKKonCFP0KmnYY54IbwtHXocvGkf2GCBSXzoBs3gCSkOvLk1J7 7L69lBNpJyt4h7zVwARewMMdc5ftGGz1d1Y6fFHFDSW0Sfhjx73fLJ44eYaZSR91rSHK BNDw== X-Gm-Message-State: ALyK8tLClmIqNQljg7JiYofsQLyPGR8VJSfzxgibI7ZnW29BfkEmPD71rMlyA+0JQqUKgDiE29i1pk9AaHBzDA== X-Received: by 10.194.70.41 with SMTP id j9mr23144661wju.30.1466696960949; Thu, 23 Jun 2016 08:49:20 -0700 (PDT) In-Reply-To: <576bd818$0$1619$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> <56ecacd4-cc17-48ec-9830-57c8113d16f6@googlegroups.com> <576b5ea3$0$1595$c3e8da3$5496439d@news.astraweb.com> <576B96C0.2040106@rece.vub.ac.be> <576bae4c$0$11112$c3e8da3@news.astraweb.com> <576BB841.1080603@rece.vub.ac.be> <576bd818$0$1619$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:110423 On Thu, Jun 23, 2016 at 10:37 PM, Steven D'Aprano wrote: > I acknowledge, cheerfully, that there might be a mismatch between what you > expect and what the object actually does. "I expect empty containers to be > falsey, and non-empty ones to be truthy; but this RedBlackTree object is > always false even if it has many items; and this SortedDict is always true > even when it is empty." > > That's a nuisance and a pain when it happens, but it's arguably a bug in the > object or at least a misfeature... As evidenced by the change to time truthiness, yes, that's the object's fault. If your RedBlackTree object were always *true*, I'd call it a missing feature ("please add a __bool__ that distinguishes empty trees from trees with content"), but always *false* would be a bug. A SortedDict implies by its name that it should be extremely dict-like, so that would be a strong argument for its truthiness to follow a dict's. Either way, the misbehaviour gets pointed back at the object in question. ChrisA