Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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; 'operator': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'plenty': 0.07; 'integers': 0.09; 'lawrence': 0.09; 'mixed': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrong,': 0.09; 'assume': 0.14; 'language.': 0.14; 'equivalence': 0.16; 'operators.': 0.16; 'precedence': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'roy': 0.16; 'spacing': 0.16; 'utc,': 0.16; 'prevent': 0.16; 'thursday,': 0.16; 'student': 0.16; 'language': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'pointed': 0.19; 'thanks.': 0.20; '>>>': 0.22; 'rules': 0.22; 'header:User- Agent:1': 0.23; 'example.': 0.24; 'url:moin': 0.24; 'helpful': 0.24; 'possibly': 0.26; 'right.': 0.26; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'url:wiki': 0.31; 'context.': 0.31; 'operators': 0.31; 'agreed': 0.32; 'url:python': 0.33; 'cases': 0.33; 'table': 0.34; 'sense': 0.34; 'agree': 0.35; 'but': 0.35; 'there': 0.35; 'leads': 0.36; 'url:org': 0.36; 'should': 0.36; 'january': 0.37; 'two': 0.37; 'to:addr:python- list': 0.38; 'that,': 0.38; 'explain': 0.39; 'aspects': 0.39; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'above,': 0.60; 'expression': 0.60; 'simple,': 0.60; 'full': 0.61; 'our': 0.64; '30,': 0.65; 'smith': 0.68; 'pro': 0.69; 'article': 0.77; 'everything.': 0.84; 'received:89': 0.85; 'subject:True': 0.91; 'responses': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: 1 > 0 == True -> False Date: Thu, 30 Jan 2014 17:42:26 +0000 References: <99b0aa22-5fb3-460a-a080-dacb1c0f2fda@googlegroups.com> <3dcdc95d-5e30-46d3-b558-afedf9723c7c@googlegroups.com> <5ebb3d58-c23e-4938-924d-df7121ca1d04@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-89-240-160-29.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <5ebb3d58-c23e-4938-924d-df7121ca1d04@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 60 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391103762 news.xs4all.nl 2918 [2001:888:2000:d::a6]:46831 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65030 On 30/01/2014 14:46, Thibault Langlois wrote: > On Thursday, January 30, 2014 2:08:58 PM UTC, Roy Smith wrote: >> In article <3dcdc95d-5e30-46d3-b558-afedf9723c7c@googlegroups.com>, >> >> Thibault Langlois wrote: >> >> >> >>> You are right. I should have given some context. >> >>> I am looking at this from the perspective of the teacher that has to explain >> >>> idiosyncrasies of the language to inexperienced students. >> >>> There are two aspects in this example. >> >>> 1. the equivalence of True/False with integers 1/0 which have pro and cons. >> >>> 2. the chaining rules of operators. I agree that it may make sense in some >> >>> cases like x > y > z but when operators are mixed it leads to counter >> >>> intuitive cases as the one I pointed out. >> >>> >> >>> The recommendations to student are 1) do not assume True == 1 and do not use >> >>> operator chaining. >> >> >> >> Better than that, do what I do. >> >> >> >> 1) Assume that you don't have the full operator precedence table >> >> memorized and just parenthesize everything. >> >> >> >> 2) In cases where the expression is so simple, you couldn't possibly be >> >> wrong, see rule #1. > > Agreed ! > Pleased to see that as always plenty of helpful responses here. In return would you please read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the double line spacing above, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence