Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Operator Precedence/Boolean Logic Date: Wed, 22 Jun 2016 13:59:10 +1000 Lines: 58 Message-ID: References: <15997174-44d5-431c-8f90-a8d700921820@googlegroups.com> <85y45xx4a9.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de Hd7Q6zhDU6US4WkavKag+AnISCxpGQfpArWTOsX6lcbA== Cancel-Lock: sha1:46mvAN4zuLai8dRXkyAZLE+r9Y0= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'expressions': 0.07; 'true)': 0.07; 'false)': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'repl': 0.09; ':-)': 0.12; 'interpreter': 0.15; 'confusion': 0.16; 'false:': 0.16; 'helps.': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'tutoring': 0.16; 'url:tutor': 0.16; '>>>': 0.20; '(the': 0.22; 'users,': 0.22; 'component': 0.23; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'fine': 0.28; 'adams': 0.29; 'subject:/': 0.30; 'url:mailman': 0.30; 'help!': 0.30; 'url:python': 0.33; 'true.': 0.33; 'url:listinfo': 0.34; 'false': 0.35; 'quite': 0.35; 'express': 0.35; 'but': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'there,': 0.37; 'received:org': 0.37; 'thank': 0.38; 'does': 0.39; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'still': 0.40; 'questions': 0.40; 'your': 0.60; 'hope': 0.61; 'more': 0.63; 'to,': 0.63; 'results': 0.66; 'elizabeth': 0.72; 'evaluate': 0.72; '_o__)': 0.84; 'confusing': 0.84; 'heh.': 0.84; 'net,': 0.84; 'received:125': 0.84; 'welcome!': 0.84; '\xe2\x80\xa6': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) 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: <85y45xx4a9.fsf@benfinney.id.au> X-Mailman-Original-References: <15997174-44d5-431c-8f90-a8d700921820@googlegroups.com> Xref: csiph.com comp.lang.python:110285 Elizabeth Weiss writes: > Hi There, Welcome! Your questions are fine here, but you may like to know that we also have a beginner-specific forum for collaborative tutoring . > I am a little confused as to how this is False: > False==(False or True) > > I would think it is True because False==False is true. What does ‘(False or True)’ evaluate to, when you try it in the REPL? > I think the parenthesis are confusing me. > (False==False) or True > > This is True. Is it because False==False? And True==False is not True > but that does not change that this is True. Heh. You express the confusion quite well :-) Try the component expressions in the REPL (the interactive interpreter session) and see if that helps:: >>> False or True … >>> (False or True) … >>> True == False … >>> (True == False) … >>> False == False … >>> (False == False) … Then, once you think you understand what those expressions evaluate to, look again at how those results would work in a more complex expression:: >>> False == (False or True) … >>> (False == False) or True … > Thank you for your help! I hope that helps. -- \ “[W]e are still the first generation of users, and for all that | `\ we may have invented the net, we still don't really get it.” | _o__) —Douglas Adams | Ben Finney