Statement evals as False in my IDE and True elsewhere

Chris Angelico rosuav at gmail.com
Thu Jan 30 18:25:41 EST 2014


On Fri, Jan 31, 2014 at 10:00 AM, CM <cmpython at 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



More information about the Python-list mailing list