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

References <a543e1a5-ef00-42b0-96df-5bf9ee8ac74c@googlegroups.com> <mailman.6171.1391121221.18130.python-list@python.org> <5673ebd0-89b6-485c-8ccb-f62bf15f513a@googlegroups.com>
Date 2014-01-31 10:25 +1100
Subject Re: Statement evals as False in my IDE and True elsewhere
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.6178.1391124349.18130.python-list@python.org> (permalink)

Show all headers | 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