Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: =?UTF-8?Q?Andreas_R=c3=b6hler?= Newsgroups: comp.lang.python Subject: Re: Operator Precedence/Boolean Logic Date: Thu, 23 Jun 2016 08:34:41 +0200 Lines: 27 Message-ID: References: <15997174-44d5-431c-8f90-a8d700921820@googlegroups.com> <56ecacd4-cc17-48ec-9830-57c8113d16f6@googlegroups.com> <3a840cef-24d2-4abb-8e5b-dc80bf48944d@googlegroups.com> <63fe7ea9-a14f-94a2-cdd5-27aa902fbf6b@online.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 4ia8PNPJrr2KNEqJ2zOxFAfWR2MQ7NpenuOWeMhmr/nw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'none,': 0.05; 'expressions': 0.07; 'false,': 0.07; 'interpreted': 0.07; 'received:192.168.178': 0.07; 'indeed,': 0.09; 'spec': 0.09; '<>.': 0.11; 'thursday,': 0.13; '2016': 0.16; '23,': 0.16; 'boolean': 0.16; 'conditional': 0.16; 'containers': 0.16; 'false:': 0.16; 'frozensets).': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rule.': 0.16; 'wrote:': 0.16; 'language': 0.19; '>>>': 0.20; 'lawrence': 0.22; 'simpler': 0.22; 'am,': 0.23; '(or': 0.23; 'seems': 0.23; "python's": 0.23; 'sets': 0.23; 'header:In-Reply-To:1': 0.24; 'url:bugs': 0.24; 'header :User-Agent:1': 0.26; 'values': 0.28; 'larry': 0.29; 'operators': 0.29; 'strings,': 0.29; 'types.': 0.29; 'subject:/': 0.30; '(including': 0.30; 'operate': 0.32; 'class': 0.33; 'url:python': 0.33; 'common': 0.33; 'errors,': 0.33; 'legacy': 0.33; 'rule': 0.33; 'values.': 0.33; 'languages': 0.34; 'gets': 0.35; 'false': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'why': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'url:3': 0.60; 'different': 0.63; 'received:217.72': 0.66; 'received:217.72.192': 0.66; 'received:217': 0.66; 'enhances': 0.84; 'strengths': 0.84; 'url:reference': 0.91 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.1.0 In-Reply-To: <3a840cef-24d2-4abb-8e5b-dc80bf48944d@googlegroups.com> X-Provags-ID: V03:K0:49uzKIwQdc3NHdcve5ICEdf9c4CpT+c2pr23URLhF3kvrQvd4/q IoqAaM6kiue8REZyneY8M54NaF7B7evKm/zKNcLqqdReMD2Zp2XXvmUSPsJsyn77Pqbd2bL DdT6tYVXxZauFEXuZR5sZtndlg0zjQs5M4dF8oxxGg86+sU2hDVRaXvNrm2RFSH6JDyoI7B 1fGAjCK8qPR8huQ6LonFQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:5+EFsOulmUI=:APDIjIVScaGbrsuUAQL3YA 5TXS7rxYlkjAIqXRu88Yj26ja48QeE8NNxloOkiLQuykH9734DyVmI2EaShHTeATTOUsCD5mJ poYbWxnBD1oWUkugKjPwXIn9dWiIG7A5gcemRc/WkLV3+KYg3JeN0PyI22vu5l+EBxoFDjFO8 Opmg9LSzSGptRUcxdWXwQl5ddDv3+sCYDFVwo9Y3eA6QaFlUJAocEI8cZbjPSu9k5HYanR2Rd uaPxiDjiVolt6dnOSnPNkoqkRqITPRk1GkXgiPgu/c1XjCj9OFcj8GIai6GG04q6ZBreW1BJZ hnUlRt0JrHAa9eoV9VTnF2dKsfdJ+7YJauFVJ+vW1vGp6pk9d2bBa63gEN4drXPt/lzarfEPr zW8E6fiuh8SjOehku15sa5/rxoR6sph8Ll9A+/kyXWH0oON6vOGk6pZp3GCorXtQuYKYRvNhr tmCis9tb5VoIOIjTIpLbDUV+sukY5YWFvjvHANB+hCqHmXQFdhUkiMPm5IBdn9XARrBWhWvOh nNQCo7q37a+wvtvEq0bSvbyDAWPJ12RI4iqAOnjlkMLspBqUSN+QvoT83ie6HTZLbHlspzpX0 jh/h+HbRNLXuRr8l48v2TPIiLhd2e14BZwciu6o8st1S+lGrCoWNZBWCz2swKjAWbZk2fWhyc sKmraZV/BgrD5bV8TF7UinpZCbQ+xG4qOHPQnxtsZLaS/1l3sNAFP9hM8qTXqDt3txrgz8GTl Zh3bxPI/FDaTDHjz 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: <63fe7ea9-a14f-94a2-cdd5-27aa902fbf6b@online.de> X-Mailman-Original-References: <15997174-44d5-431c-8f90-a8d700921820@googlegroups.com> <56ecacd4-cc17-48ec-9830-57c8113d16f6@googlegroups.com> <3a840cef-24d2-4abb-8e5b-dc80bf48944d@googlegroups.com> Xref: csiph.com comp.lang.python:110370 On 23.06.2016 06:47, Lawrence D’Oliveiro wrote: > On Thursday, June 23, 2016 at 3:12:52 PM UTC+12, Larry Hudson wrote: >> On 06/22/2016 12:42 AM, Lawrence D’Oliveiro wrote: >>> * boolean operators don’t have to operate on boolean values. The >>> language spec >>> >>> says: >>> >>> “...the following values are interpreted as false: False, None, numeric >>> zero of all types, and empty strings and containers (including strings, >>> tuples, lists, dictionaries, sets and frozensets). All other values are >>> interpreted as true.” >>> >>> I feel that’s a needlessly complicated rule. It would have been simpler if >>> boolean operators (and conditional expressions like in if-statements and >>> while-statements) only allowed values of boolean types. But that’s one of >>> the few warts in the design of Python... >> Wart?? I *strongly* disagree. I find it one of the strengths of Python, >> it enhances Python's expressiveness. > Tightening it up would rule out a whole class of common errors, from misunderstanding (or forgetting) the rule about what exactly gets interpreted as true and what as false . Indeed, why should the result of 4 - 4 have a different truth-value than 4 - 3 ? This implementation seems to be a legacy from languages without boolean types.