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


Groups > comp.lang.python > #93676

Re: 0 + not 0

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.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.018
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject: + ': 0.07; 'cc:addr:python-list': 0.09; 'precedence': 0.09; 'subject:not': 0.11; "'+'": 0.16; '1))': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'table;': 0.16; 'wrote:': 0.16; '(not': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'message- id:@mail.gmail.com': 0.27; 'arithmetic': 0.29; 'url:python': 0.33; 'gets': 0.35; 'received:google.com': 0.35; 'false': 0.35; 'url:org': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'jul': 0.72; "'not'": 0.84; 'chrisa': 0.84; 'to:none': 0.91; 'url:reference': 0.91
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=1xBBRHPpDE+C0vauzYyw0VHYMmEHp4dVpQSJPNj/kwk=; b=iC29jx66Zz5pvKwB/faAljwZsfxTUdN/GCddtZnjuNfdICxHIUfH2J8ZUNl0079ADx gMbGc3d22/r4VZbDkcuFWMzbtjBGSg8PxvR1uDknOvJvz8chRSXQ9j1BZJC5Aut+79VQ goNFSaGwHfj+JOjS0mLPiFL/UG/6Ewj0qqTZIcUiN3uli4/18oblZOXNQgaPptr6nbHC RSfYs20iqpS4Rh1kEQxBnjH7K1xD4rqcTHscjzbSv90c+aefcQgYOM/ytt8f7DG7Y3jL 9bWCp9omEiQojl1LixncXn1M+JIEQUU5YokQgqxac8AjIEMT4IJ3YbolvT5mgyV36TPx KyOQ==
MIME-Version 1.0
X-Received by 10.50.122.65 with SMTP id lq1mr3339069igb.56.1436613613763; Sat, 11 Jul 2015 04:20:13 -0700 (PDT)
In-Reply-To <55a0fa36$0$2935$e4fe514c@news.xs4all.nl>
References <01ec6551-1f40-42b0-9406-036030591519@googlegroups.com> <55a0f241$0$2933$e4fe514c@news2.news.xs4all.nl> <55a0fa36$0$2935$e4fe514c@news.xs4all.nl>
Date Sat, 11 Jul 2015 21:20:13 +1000
Subject Re: 0 + not 0
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.20+
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.417.1436613616.3674.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436613616 news.xs4all.nl 2967 [2001:888:2000:d::a6]:51769
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93676

Show key headers only | View raw


On Sat, Jul 11, 2015 at 9:12 PM, Luuk <luuk@invalid.lan> wrote:
> It can occur in an arithmetic expression, and 'not' has a higher precedence
> than '+'
> (https://docs.python.org/2/reference/expressions.html#operator-precedence)
>

I think you're misreading the table; 'not' has *lower* precedence than '+'.

> But, it gets confusing......
>>>> not 0 + 1
> False
>>>> not 0
> True
>>>> True + 1
> 2
>>>>
>
> i would expect 'not 0 + 1' to return the same value as 'True + 1'

(not 0 + 1) == (not (0 + 1))

ChrisA

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


Thread

0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 03:26 -0700
  Re: 0 + not 0 Chris Angelico <rosuav@gmail.com> - 2015-07-11 20:38 +1000
  Re: 0 + not 0 Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-07-11 12:38 +0200
    Re: 0 + not 0 Luuk <luuk@invalid.lan> - 2015-07-11 13:12 +0200
      Re: 0 + not 0 Chris Angelico <rosuav@gmail.com> - 2015-07-11 21:20 +1000
        Re: 0 + not 0 Luuk <luuk@invalid.lan> - 2015-07-11 13:30 +0200
          Re: 0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 04:54 -0700
            Re: 0 + not 0 Chris Angelico <rosuav@gmail.com> - 2015-07-11 22:05 +1000
              Re: 0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 06:22 -0700
        Re: 0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 04:48 -0700
      Re: 0 + not 0 random832@fastmail.us - 2015-07-11 16:46 -0400
  Re: 0 + not 0 Serhiy Storchaka <storchaka@gmail.com> - 2015-07-11 16:38 +0300
    Re: 0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 08:07 -0700
    Re: 0 + not 0 MRAB <python@mrabarnett.plus.com> - 2015-07-11 17:20 +0100
    Re: 0 + not 0 Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-11 10:56 -0600
      Re: 0 + not 0 Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-07-12 18:12 +1200
    Re: 0 + not 0 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-11 21:05 +0100

csiph-web