Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'output': 0.05; 'intermediate': 0.07; 'reason,': 0.07; 'craft': 0.09; 'exception.': 0.09; 'false,': 0.09; 'true)': 0.09; 'cc:addr :python-list': 0.11; 'fine.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'statement.': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'aug': 0.22; 'cc:addr:python.org': 0.22; '31,': 0.24; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply- To:1': 0.27; 'correct': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'figure': 0.32; 'worked': 0.33; 'no,': 0.35; 'received:google.com': 0.35; 'add': 0.35; "didn't": 0.36; "i'll": 0.36; 'wrong': 0.37; 'pm,': 0.38; "couldn't": 0.39; 'eye': 0.61; 'kind': 0.63; 'results': 0.69; 'overall': 0.69; 'subject:have': 0.80; 'resulted': 0.84; 'subject:times': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=aglwWgvCWBPalyu3oq3lA6hqchJI9gWuwW+ojuisFO4=; b=C8L/tMehVGAZ2KoNENgCVqnLJd3l9TOqSHfinANEH04uUjA10KFUfHGhIaHBLClhk0 wLFci0zNLuWv10kxW1M3eni4PjATL/atskvDL+JPYeep5HuCvmdv4UFp/GZMLi4VSMy/ GVU+Yl4ITVwGKT3SUW0Wu1sHTUc7YH0IRWMBkPIBoEDJmzVk0O2rY1R0UEHrd2jEZ53c Mzo0VuciFYQkXTaUaij1DpMklicEJKjtfhXYLbsvhlbTL7KZtZUust+6jhsO258OZTFE mctJuudVKgV/uvWYTwoFYOog8gAaWw7WXdvdXZGfft5ed8IGGdIzuhoB6LovOGX+NTkk COyw== MIME-Version: 1.0 X-Received: by 10.50.30.72 with SMTP id q8mr9198022igh.14.1409476575109; Sun, 31 Aug 2014 02:16:15 -0700 (PDT) In-Reply-To: <5402deb1$0$9505$c3e8da3$5496439d@news.astraweb.com> References: <5402deb1$0$9505$c3e8da3$5496439d@news.astraweb.com> Date: Sun, 31 Aug 2014 19:16:14 +1000 Subject: Re: I have tried and errored a reasonable amount of times From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409476577 news.xs4all.nl 2915 [2001:888:2000:d::a6]:51731 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77345 On Sun, Aug 31, 2014 at 6:37 PM, Steven D'Aprano wrote: > - Use print() to see the intermediate results: > > a = e[0].isupper > print(e[0], a, a == False, a == True) And I'll add to this: *Copy and paste* the original code to craft this output statement. I recently was trying to figure out a problem, and retyped to create the output statements... and I didn't make the same typo, so it worked fine. For some reason, my eye didn't notice the error, and I couldn't understand why the intermediate results were correct and the overall result was wrong. (And no, it wasn't the kind of 'wrong' that results in a nice tidy exception. It just resulted in wrong results.) ChrisA