Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!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.057 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'say,': 0.05; 'cc:addr :python-list': 0.11; 'jan': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'trying': 0.19; 'pieces': 0.19; 'appears': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'this?': 0.23; '31,': 0.24; 'cc:2**0': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; "skip:' 10": 0.31; 'this.': 0.32; 'fri,': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'that,': 0.38; 'anything': 0.39; 'sure': 0.39; 'entire': 0.61; "you'll": 0.62; 'show': 0.63; 'between': 0.67; 'divide': 0.84; 'subject:Statement': 0.91; 'subject:True': 0.91; '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=Isqa+9nW28vnNuk3jBScBJ6fvQEunrVwrXV449BW0qo=; b=V+M36ZT940MCMBUWF/hn9ZrHoJmEJI5XI+sBubhyllAbR5fAryVflm5QkvFEaarZ6J a91iHSG5ofZi+QCCEl5wIwKlcLle8yh6ejOBWIVMhzNuIY408Z6/f15TkhxROGxu+hyq H62yQ6zmJODAedKAVTjstHgxCv9SquvcJRr8ZGfcV+aJS7sE/Sk3UxeTyF/FIGVsgElQ tWR3QZLsOCNXMVTTdIxhwEM8pCoKhnauGH0jvYOZB4IS38GgPklzxqytWMQNL8dCZhx4 /M+/R6vOZihDakPs2CjQMzN8rU0LYlBlwWqrKP2D329Bn1HQ5caAxcsgf0DXSNskEPyY wh7A== MIME-Version: 1.0 X-Received: by 10.66.164.229 with SMTP id yt5mr17215577pab.67.1391120732031; Thu, 30 Jan 2014 14:25:32 -0800 (PST) In-Reply-To: References: Date: Fri, 31 Jan 2014 09:25:31 +1100 Subject: Re: Statement evals as False in my IDE and True elsewhere 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391121221 news.xs4all.nl 2901 [2001:888:2000:d::a6]:37450 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65056 On Fri, Jan 31, 2014 at 9:04 AM, CM wrote: > fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] > fake_result = not all(i == '[omitted]' for i in fake_data) > print 'This is fake result: ', fake_result Trying to get my head around this. You want to see if all the values in fake_data are '[omitted]' or not? That is to say, if there's anything that isn't '[omitted]'? Not sure that that's a normal thing to be asking, but that's what your code appears to do. What happens if you try this? fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] fake_result = set(fake_data)>{'[omitted]'} In theory, that should do the exact same thing as your code (returning True if there's anything in fake_data that is not '[omitted]'). The other thing to try is peppering your code with print statements. Divide the work up into pieces - show the entire loop and what happens - print out everything you can imagine. See where the difference begins between inside and outside the IDE. Once you find that, you'll have a clue as to what's wrong. ChrisA