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


Groups > comp.lang.python > #75469

Re: dict to boolean expression, how to?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; "'a'": 0.09; 'cc:addr :python-list': 0.11; '0))': 0.16; '10:45': 0.16; 'bool': 0.16; 'boolean': 0.16; 'fetch': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:expression': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'alex': 0.19; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'this:': 0.26; 'van': 0.27; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; 'fri,': 0.33; 'equal': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'pm,': 0.38; 'bad': 0.39; 'sure': 0.39; 'how': 0.40; 'expression': 0.60; '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=klBowKyZ/QU1fqTCHvl0u9l7ReS2Uhuq7ehpGcwCorI=; b=Wtpwvkh42YutK3W27KsuDXan3X/iFRjzYc63BB+JgG+Td2h3HDsPM0WAiU/cMK3LXL 5CdFX19qlqYvw2TCC0Ui0SWHKVqpF7DI3bdybiC9aLHizZCKUt/xXhRNy41Nx9XEokx9 edAipRXdwXsvRrqHZCUnfipd1TxtzuRIxEv11UR4UduUp0F4g/1lYALNBxJ19gJPg+jV j8e/d6D+kkXaV4Vx5NysT7naNRQROIVPqfH4vhSTSiMDRxLmH1byXynPgx3GofI/pOks 1ZcRI0Zb2alzjMxJ1Avajy+6kcjOfQGcFfyceBGclZnw522bjYNbknvTt3kGgEq3Z2SD 2bQA==
MIME-Version 1.0
X-Received by 10.43.96.65 with SMTP id cf1mr6898228icc.26.1406898243197; Fri, 01 Aug 2014 06:04:03 -0700 (PDT)
In-Reply-To <53db8bd8$0$2976$e4fe514c@news2.news.xs4all.nl>
References <53db8bd8$0$2976$e4fe514c@news2.news.xs4all.nl>
Date Fri, 1 Aug 2014 23:04:03 +1000
Subject Re: dict to boolean expression, how to?
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.12509.1406898246.18130.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1406898246 news.xs4all.nl 2844 [2001:888:2000:d::a6]:42133
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75469

Show key headers only | View raw


On Fri, Aug 1, 2014 at 10:45 PM, Alex van der Spek <zdoor@xs4all.nl> wrote:
> how would you make a boolean expression like this:
>
> bool = (('a' == 1) & ('A' == 0) |
>         ('b' == 1) & ('B' == 0) |
>         ('c' == 1) & ('C' == 0))

Not sure what the use of this is, because 'a' will never be equal to
1. Are you trying to magically fetch names from your environment?
Because that's usually a bad idea.

ChrisA

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


Thread

dict to boolean expression, how to? Alex van der Spek <zdoor@xs4all.nl> - 2014-08-01 12:45 +0000
  Re: dict to boolean expression, how to? Chris Angelico <rosuav@gmail.com> - 2014-08-01 23:04 +1000
  Re: dict to boolean expression, how to? Roy Smith <roy@panix.com> - 2014-08-01 09:24 -0400
  Re: dict to boolean expression, how to? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-01 13:28 +0000
    Re: dict to boolean expression, how to? Roy Smith <roy@panix.com> - 2014-08-01 09:32 -0400
      Re: dict to boolean expression, how to? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-01 15:02 +0000
        Re: dict to boolean expression, how to? Terry Reedy <tjreedy@udel.edu> - 2014-08-01 18:16 -0400
    Re: dict to boolean expression, how to? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-01 16:50 +0100
      Re: dict to boolean expression, how to? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-01 16:35 +0000
  Re: dict to boolean expression, how to? Alex van der Spek <zdoor@xs4all.nl> - 2014-08-01 14:26 +0000
    Re: dict to boolean expression, how to? marco.nawijn@colosso.nl - 2014-08-01 08:07 -0700
    Re: dict to boolean expression, how to? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-01 15:24 +0000
      Re: dict to boolean expression, how to? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-01 17:03 +0100
    Re: dict to boolean expression, how to? Peter Otten <__peter__@web.de> - 2014-08-01 17:44 +0200
      eval [was Re: dict to boolean expression, how to?] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-02 02:59 +0000
        Re: eval [was Re: dict to boolean expression, how to?] Peter Otten <__peter__@web.de> - 2014-08-02 09:43 +0200
        Re: eval [was Re: dict to boolean expression, how to?] Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-02 08:59 +0100
        Re: eval [was Re: dict to boolean expression, how to?] Duncan Booth <duncan.booth@invalid.invalid> - 2014-08-05 11:57 +0000
          Re: eval [was Re: dict to boolean expression, how to?] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-06 02:25 +1000
    Re: dict to boolean expression, how to? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-01 17:12 +0100
    Re: dict to boolean expression, how to? Peter Pearson <ppearson@nowhere.invalid> - 2014-08-01 17:00 +0000
  Re: dict to boolean expression, how to? Ned Batchelder <ned@nedbatchelder.com> - 2014-08-01 10:29 -0400

csiph-web