Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65067

Re: Statement evals as False in my IDE and True elsewhere

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.095
X-Spam-Evidence '*H*': 0.82; '*S*': 0.01; 'calculating': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; '10:00': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hashable': 0.16; 'ought': 0.16; 'wrote:': 0.18; 'work,': 0.20; 'written': 0.21; 'example': 0.22; 'cc:addr:python.org': 0.22; '31,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'fri,': 0.33; 'could': 0.34; 'something': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'wrong': 0.37; 'list': 0.37; 'list,': 0.38; 'supporting': 0.39; 'even': 0.60; 'is.': 0.60; 'first': 0.61; 'more': 0.64; 'as:': 0.81; 'comment.': 0.84; 'suspicion': 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=PyWmWDUTyuNUT0he0pVmRQuU6BejH7Rx4mzbm83jaH8=; b=MOVz/UwNs4O9bvwDQI7VIvTVqh4WOu8rYLo9MsKYtj6+P5H4yNEtCcll9jjTySbyKk x6yJ5XcwE+fObu3vxKY7KoESy+tKzmW9v88SPSYaAUbVuj2qFCfZQIOQdJ6J5QF2w3AS XakBw4Xea/TIPyYmZedLGXIrm5DHh0/jKF0Y6Ab4m5a9Y1zjhc1Qldn85VGaqL4N4Y1J 8cQDXaO8JwMfm1AAdXkiTGrrh77F3C5WY0cIrbphKS4mTubKd6ZiKxRt42TL5TCqRjhs 3ae/+Gpth1HGTAie5FUSPQid/PcKJ1AkXN8psvrV1F6xDZxOZZJqgqYZCK8zM0RS7075 eJrw==
MIME-Version 1.0
X-Received by 10.68.133.6 with SMTP id oy6mr17118697pbb.153.1391124341356; Thu, 30 Jan 2014 15:25:41 -0800 (PST)
In-Reply-To <5673ebd0-89b6-485c-8ccb-f62bf15f513a@googlegroups.com>
References <a543e1a5-ef00-42b0-96df-5bf9ee8ac74c@googlegroups.com> <mailman.6171.1391121221.18130.python-list@python.org> <5673ebd0-89b6-485c-8ccb-f62bf15f513a@googlegroups.com>
Date Fri, 31 Jan 2014 10:25:41 +1100
Subject Re: Statement evals as False in my IDE and True elsewhere
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6178.1391124349.18130.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1391124349 news.xs4all.nl 2916 [2001:888:2000:d::a6]:41636
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:65067

Show key headers only | View raw


On Fri, Jan 31, 2014 at 10:00 AM, CM <cmpython@gmail.com> wrote:
> Essentially, if ALL the items in that list are '[omitted]', I must not process the list, but if even one of them is something other than '[omitted]', I need to process it.

Okay. The set example that I gave will work, then - as long as all
items are hashable (if they're strings, they are). Up to you which
one's more readable.

In any case, that could do with a supporting comment. My first
suspicion was that it ought to be written as:

fake_result = '[omitted]' not in fake_data

and that it was calculating the wrong thing. But it is doing what you
think it is.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Statement evals as False in my IDE and True elsewhere CM <cmpython@gmail.com> - 2014-01-30 14:04 -0800
  Re: Statement evals as False in my IDE and True elsewhere Peter Otten <__peter__@web.de> - 2014-01-30 23:14 +0100
    Re: Statement evals as False in my IDE and True elsewhere CM <cmpython@gmail.com> - 2014-01-30 14:48 -0800
      Re: Statement evals as False in my IDE and True elsewhere Chris Angelico <rosuav@gmail.com> - 2014-01-31 09:55 +1100
        Re: Statement evals as False in my IDE and True elsewhere CM <cmpython@gmail.com> - 2014-01-30 15:02 -0800
      Re: Statement evals as False in my IDE and True elsewhere Peter Otten <__peter__@web.de> - 2014-01-31 00:08 +0100
      Re: Statement evals as False in my IDE and True elsewhere Terry Reedy <tjreedy@udel.edu> - 2014-01-31 00:05 -0500
      Re: Statement evals as False in my IDE and True elsewhere Chris Angelico <rosuav@gmail.com> - 2014-01-31 16:07 +1100
  Re: Statement evals as False in my IDE and True elsewhere Chris Angelico <rosuav@gmail.com> - 2014-01-31 09:25 +1100
    Re: Statement evals as False in my IDE and True elsewhere CM <cmpython@gmail.com> - 2014-01-30 15:00 -0800
      Re: Statement evals as False in my IDE and True elsewhere Chris Angelico <rosuav@gmail.com> - 2014-01-31 10:25 +1100
      Re: Statement evals as False in my IDE and True elsewhere Terry Reedy <tjreedy@udel.edu> - 2014-01-31 00:09 -0500

csiph-web