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


Groups > comp.lang.python > #93701

Re: 0 + not 0

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: 0 + not 0
Date 2015-07-11 21:05 +0100
References <01ec6551-1f40-42b0-9406-036030591519@googlegroups.com> <mailman.420.1436621919.3674.python-list@python.org> <not-20150711180044@ram.dialup.fu-berlin.de> <CALwzidm4QvBQ_4XZsuLTw8rzWmd3trT4W+P3XcH0CBWb7Vyb1g@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.432.1436645136.3674.python-list@python.org> (permalink)

Show all headers | View raw


On 11/07/2015 17:56, Ian Kelly wrote:
> 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.
>

http://bugs.python.org/issue24612

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | NextPrevious 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