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


Groups > comp.lang.python > #93673

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!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.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'operator': 0.03; 'subject: + ': 0.07; 'cc:addr:python-list': 0.09; 'handled.': 0.09; 'subject:not': 0.11; 'syntax': 0.13; 'construct.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'parser.': 0.16; 'syntaxerror:': 0.16; 'which,': 0.16; 'wrote:': 0.16; 'say,': 0.18; '(not': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '"",': 0.22; 'sat,': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; "i'm": 0.30; 'certainly': 0.30; "can't": 0.32; 'possibly': 0.32; 'maybe': 0.33; 'url:python': 0.33; 'common': 0.33; 'file': 0.34; 'received:google.com': 0.35; 'url:org': 0.36; 'limitation': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'wrong': 0.38; 'why': 0.39; 'sure': 0.39; 'url:3': 0.60; 'jul': 0.72; 'special': 0.73; '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=Cw8+4D4fdwLYM6qYZ9BVMdQBhK1cGtavaT8PYsx5cRQ=; b=Sa8uNOrlUupVDz42ykupn/VLGP0DcJDfWtA/YNI2EFiaw53CZX3MOxMtIPAStP9C6j pctA8LdK5OtJ1IItn0kbg6MXYxgYRNR+RybFBBY5yYdo/oS7PfaO4343Yzjf/Ei4L249 WE1F8VEoBhb3gikAlBty8NqQe5lqjnzQ/bhpNgX0d0/wT7S3qa69TOopCaeK4F6JW7HQ 2F+wMpbFf41gVw4UKIaPZZygWpajNe4d2WAZve+tlfFFoXJMtgGBwxmiUbsc7n8biB+D tVXnvndtlYzGrtFm611b+Wp08RD4jIV716k3Ue2/wOFUyJc8kabfVJhpx26tR/qEjSTI JO4g==
MIME-Version 1.0
X-Received by 10.107.159.66 with SMTP id i63mr38473177ioe.68.1436611132913; Sat, 11 Jul 2015 03:38:52 -0700 (PDT)
In-Reply-To <01ec6551-1f40-42b0-9406-036030591519@googlegroups.com>
References <01ec6551-1f40-42b0-9406-036030591519@googlegroups.com>
Date Sat, 11 Jul 2015 20:38:52 +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.416.1436611135.3674.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436611135 news.xs4all.nl 2962 [2001:888:2000:d::a6]:41867
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93673

Show key headers only | View raw


On Sat, Jul 11, 2015 at 8:26 PM, candide <c.candide@laposte.net> wrote:
>>>> 0 + not 0
>   File "<stdin>", line 1
>     0 + not 0
>           ^
> SyntaxError: invalid syntax
>>>>
>
>
> What is syntactically wrong with 0 + not 0?

I'm actually not sure why this can't be handled. Possibly it's a
limitation of the parser. Certainly 0 + (not 0) works just fine. This
suggests that the exponentiation operator may have been special-cased
to cope with this:

https://docs.python.org/3/reference/expressions.html#id21

So maybe there's just no corresponding special case for this - which,
I have to say, is not exactly a common construct.

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