Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bits': 0.07; 'see:': 0.07; '>>>>': 0.09; 'conditional': 0.09; 'false,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'ascending': 0.16; 'boolean': 0.16; 'expression.': 0.16; 'stef': 0.16; 'operations,': 0.16; 'cheers,': 0.19; 'header :In-Reply-To:1': 0.21; 'priority:': 0.23; 'notes': 0.26; 'true,': 0.29; 'second': 0.30; 'looks': 0.31; 'header:X-Complaints-To:1': 0.32; 'to:addr:python-list': 0.33; 'operations': 0.33; 'header :User-Agent:1': 0.35; 'ordered': 0.35; 'else': 0.35; 'or,': 0.37; 'url:docs': 0.37; 'url:python': 0.38; 'received:org': 0.38; 'hello,': 0.38; 'url:org': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; '(3)': 0.63; 'funny': 0.76; '15:23': 0.84; 'look,': 0.84; 'sight,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: "Colin J. Williams" Subject: Re: and becomes or and or becomes and Date: Mon, 23 May 2011 08:20:16 -0400 References: <4DD96297.5010909@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 206-248-163-18.dsl.teksavvy.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: <4DD96297.5010909@gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 35 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306153236 news.xs4all.nl 49042 [::ffff:82.94.164.166]:58553 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6070 On 22-May-11 15:23 PM, Stef Mientki wrote: > hello, > > must of us will not use single bits these days, > but at first sight, this looks funny : > >>>> a=2 >>>> b=6 >>>> a and b > 6 >>>> a& b > 2 >>>> a or b > 2 >>>> a | b > 6 > > cheers, > Stef 5.2. Boolean Operations — and, or, not These are the Boolean operations, ordered by ascending priority: Operation Result Notes x or y if x is false, then y, else x (1) x and y if x is false, then x, else y (2) not x if x is false, then True, else False (3) The second line is puzzling at first look, but consistent. It is analogous to the Conditional Expression. See: http://docs.python.org/reference/expressions.html#conditional-expressions Colin W.