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


Groups > comp.lang.python > #93696

Re: 0 + not 0

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'operand': 0.07; 'subject: + ': 0.07; '"+"': 0.09; 'atom': 0.09; 'identifier': 0.09; 'literal': 0.09; 'python': 0.10; 'subject:not': 0.11; '"%"': 0.16; '"*"': 0.16; '"-"': 0.16; '"/"': 0.16; '"//"': 0.16; '"and"': 0.16; '"not"': 0.16; '"or"': 0.16; '"~"': 0.16; '::=': 0.16; '["**"': 0.16; 'a_expr': 0.16; 'and_test': 0.16; 'attributeref': 0.16; 'bug,': 0.16; 'dict_display': 0.16; 'list_display': 0.16; 'm_expr': 0.16; 'not_test': 0.16; 'or_test': 0.16; 'surprising': 0.16; 'u_expr': 0.16; 'wrote:': 0.16; 'stefan': 0.18; '2015': 0.20; 'am,': 0.23; 'sat,': 0.23; 'written': 0.24; 'header:In- Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'comparison': 0.29; 'primary': 0.31; 'possibly': 0.32; 'ram': 0.33; 'received:google.com': 0.35; 'so,': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'does': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'behavior': 0.61; 'skip:\xc2 10': 0.67; 'jul': 0.72; 'power': 0.72; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=ZTescWkLa+JKFZRz69bM38I9V3f8BRrxmQEevYxaN38=; b=q/AgAwkLDZhzq6s+rLwq4BF0Bt3MmrMezsWqgdlqd5syX74YJh1eH+3tr2LUyvBkq5 fbd3S9nTFQqWGw4BLLgG2ySuoUkA/NtjUHJL4bQ/4p17yMUY1k3t8dRln0xgJAvdpADj 4p+OaWBfvV5UoVBb4TcFw34JNFwlCMDlcukvaedDGewGhNtAYHINosJpiEVqe85IIBrO MqyGv9xpouuyHSTcpebLiIDjPeS25iTLokhMxvFiekl+0Apy5Q9WhWKZyd+rxLjWzgpK O8Zs/4I42qAn5nE1Hx5efsU2wiC5iPJp295c1T/QhgJA0LGCt+cBlsNGDg8GtkPbKwuJ JDEg==
X-Received by 10.13.229.198 with SMTP id o189mr29487837ywe.108.1436633803728; Sat, 11 Jul 2015 09:56:43 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <not-20150711180044@ram.dialup.fu-berlin.de>
References <01ec6551-1f40-42b0-9406-036030591519@googlegroups.com> <mailman.420.1436621919.3674.python-list@python.org> <not-20150711180044@ram.dialup.fu-berlin.de>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sat, 11 Jul 2015 10:56:04 -0600
Subject Re: 0 + not 0
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
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.428.1436633811.3674.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436633811 news.xs4all.nl 2941 [2001:888:2000:d::a6]:41567
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93696

Show key headers only | View raw


On Sat, Jul 11, 2015 at 10:02 AM, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>   I look at Python 3.4.3:
>
> a_expr ::=  m_expr | a_expr "+" m_expr | a_expr "-" m_expr
>
>   So, »not 0« must be an »m_expr« when used as the right operand of »+«.
>
> m_expr ::=  u_expr | m_expr "*" u_expr | m_expr "//" u_expr | m_expr "/" u_expr | m_expr "%" u_expr
> u_expr ::=  power | "-" u_expr | "+" u_expr | "~" u_expr
> power ::=  primary ["**" u_expr]
> primary ::=  atom | attributeref | subscription | slicing | call
> atom      ::=  identifier | literal | enclosure
> enclosure ::=  parenth_form | list_display | dict_display | set_display | generator_expression | yield_atom
>
>   How can there be a »not«?
>
>   »not« is used in
>
> not_test ::=  comparison | "not" not_test
> and_test ::=  not_test | and_test "and" not_test
> or_test  ::=  and_test | or_test "or" and_test
> conditional_expression ::=  or_test ["if" or_test "else" expression]
> expression_nocond      ::=  or_test | lambda_expr_nocond
> expression             ::=  conditional_expression | lambda_expr
>
>   , but an »expression« is not an »m_expr«.

I must concur. The grammar as written does not actually produce 1 +
not 0. I think it's still worthwhile opening a bug, because the
behavior is surprising and possibly not intentional.

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