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: 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 Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Sat, Jul 11, 2015 at 8:26 PM, candide wrote: >>>> 0 + not 0 > File "", 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