Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.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; '(using': 0.07; 'constructor': 0.09; 'ide': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'def': 0.12; 'hint:': 0.16; 'numpy': 0.16; 'possible?': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'wrote:': 0.18; 'seems': 0.21; '>>>': 0.22; 'import': 0.22; 'shell': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'change,': 0.30; 'program,': 0.31; 'code': 0.31; 'lines': 0.31; '>>>>': 0.31; 'run': 0.32; 'running': 0.33; 'but': 0.35; 'there': 0.35; 'false': 0.36; 'idle': 0.36; 'right?': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'even': 0.60; 'is.': 0.60; 'total': 0.65; 'within': 0.65; 'to,': 0.72; 'evaluate': 0.72; 'boa': 0.84; 'on?': 0.91; 'subject:Statement': 0.91; 'subject:True': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Statement evals as False in my IDE and True elsewhere Date: Thu, 30 Jan 2014 23:14:57 +0100 Organization: None References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p5084acba.dip0.t-ipconnect.de User-Agent: KNode/4.7.3 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391120094 news.xs4all.nl 2845 [2001:888:2000:d::a6]:57837 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65054 CM wrote: > This is puzzling. (Using Python 2.5, WinXP, Boa Constructor 0.6.1 > definitely running the code through Python 2.5) > > If I run these lines in my program, through my IDE (Boa Constructor), > > 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 > > I get this result: > >>>> > This is fake result: False > > BUT, if I run those *exact same lines* (copied and pasted) in the Python > 2.5 shell within Boa Constructor, or with IDLE with Python 2.5, I get: > >>>> > This is fake result: True > > ...which is what it seems like it should evaluate to, right? What the > heck is going on? How is this even possible? There is nothing that I > know of in my code to cause this change, but perhaps there is. Otherwise > I am at a total loss. Hint: >>> def demo(): ... 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 ... >>> demo() This is fake result: True >>> from numpy import all >>> demo() This is fake result: False