Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'syntax': 0.03; 'expressions': 0.07; 'subject:code': 0.07; 'python': 0.09; 'alain': 0.09; 'correct,': 0.09; 'defined,': 0.09; 'precedence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'reference:': 0.09; 'terry': 0.09; 'def': 0.10; 'language': 0.14; 'evaluates': 0.16; 'message-id:@dough.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.17; 'certainly': 0.17; "shouldn't": 0.17; 'jan': 0.18; '>>>': 0.18; '(or': 0.18; 'supposed': 0.21; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'right.': 0.27; 'header:X-Complaints-To:1': 0.28; '"in': 0.29; 'consult': 0.29; 'writes:': 0.29; "we're": 0.30; "skip:' 10": 0.30; 'that.': 0.30; 'right?': 0.33; 'to:addr:python-list': 0.33; 'equal': 0.33; 'done': 0.34; 'pm,': 0.35; 'there': 0.35; 'received:org': 0.36; 'really': 0.36; 'but': 0.36; 'should': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'face': 0.61; 'first': 0.61; 'thomas': 0.62; 'received:fios.verizon.net': 0.84; 'technically': 0.91; 'refuse': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: code review Date: Sat, 30 Jun 2012 17:47:55 -0400 References: <6c39594f-79cb-4d4f-967e-bbc3f68cdbdf@f8g2000pbf.googlegroups.com> <4fed59b7$0$29978$c3e8da3$5496439d@news.astraweb.com> <2662370.TGmo96CKe1@PointedEars.de> <87wr2oecf6.fsf@dpt-info.u-strasbg.fr> <4FEF7117.7000109@jollybox.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-74-109-121-73.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: <4FEF7117.7000109@jollybox.de> 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1341092903 news.xs4all.nl 6988 [2001:888:2000:d::a6]:52384 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:24707 On 6/30/2012 5:35 PM, Thomas Jollans wrote: > On 06/30/2012 11:07 PM, Alain Ketterlin wrote: >> Thomas Jollans writes: >> >>>>>>> def is_valid_password(password): >>>>>>> return mud.minpass <= len(password) <= mud.maxpass >> >>> Which of the two comparisons is done first anyway? >>> "In the face of ambiguity, refuse the temptation to guess." >> >> There is no ambiguity. See the language reference: > > Of course it's technically clearly defined, but the syntax isn't > explicit. To know what the order is (or whether there is an order!) one > has to consult the language reference (which shouldn't be necessary), or > make an educated guess, which would almost certainly be correct, but > we're supposed to refuse the temptation to guess, right? Python pretty consistently evaluates expressions and equal precedence operators left to right. One really should learn that. No 'implementation defined' ambiguity. -- Terry Jan Reedy