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


Groups > comp.lang.python > #101507

Re: I'm missing something here...

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Skip Montanaro <skip.montanaro@gmail.com>
Newsgroups comp.lang.python
Subject Re: I'm missing something here...
Date Mon, 11 Jan 2016 19:04:03 -0600
Lines 52
Message-ID <mailman.35.1452560646.13488.python-list@python.org> (permalink)
References <mailman.26.1452554821.13488.python-list@python.org> <e18786b7-c28a-45a8-8d8d-ad82cbd29ae3@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 8TWfEFNlc6IXEkpw7AwBHQKBaFAY1P3kcHCiwD7JFMGA==
Return-Path <skip.montanaro@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; 'method.': 0.05; 'subject:missing': 0.07; 'cc:addr:python-list': 0.09; 'output': 0.13; 'argument': 0.15; 'bug,': 0.16; 'call)': 0.16; 'cc:name:python': 0.16; 'lhs': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rhs': 0.16; 'something.': 0.16; 'skip': 0.18; 'tells': 0.18; 'versions': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '(the': 0.22; 'sorry,': 0.22; 'ignored.': 0.23; 'thanks,': 0.24; 'tried': 0.24; 'header:In- Reply-To:1': 0.24; 'not.': 0.27; 'least': 0.27; 'message- id:@mail.gmail.com': 0.27; 'actual': 0.28; 'occurred': 0.29; "can't": 0.32; '8bit%:25': 0.33; "i'll": 0.33; 'received:google.com': 0.35; 'set.': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'list.': 0.37; 'version': 0.38; 'received:209': 0.38; 'does': 0.39; 'bring': 0.62; 'reply': 0.68; '8bit%:21': 0.70; 'skip:\xe2 10': 0.70; '\xc2\xa068': 0.84; 'concluded': 0.91; 'writing,': 0.91; 'convinced': 0.93
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:to :cc:content-type; bh=S5v/he1aE+iQFZ8sVzl1vQJrdVHJ1+9rayrLtqULq3M=; b=ODP4atEX4JqMUeWQCAs/ICLPavF6I+fo8ntccIdiYJktncfWRPxIK2xOQoKCmv2zQA SNkPZfjgkD5Zy6GPxS9KX44ECXI9sy/Hu6JNgNtNBur0Kkm7CeLGWcM0DSZIHNilyiXY W+kVWkSkJ5wMzEVF3FbYxtLJbqFAbc5xmmcWnhZr87UBQOxwQEesVq6cmY8mqJKKYOsG /neWsHJhqU7LeFlCqWYHThFyyfU+QXFuA22F+zzjI4J+s6LiiDgltkXfAkXXhk1RhN9r QNIOfyTZje/9FNJuFCOp5j8rxOuBRvwFqq/QcWgYmzQ6qlU51OuI/eTWIRNy2usJss5l OMYg==
X-Received by 10.140.158.4 with SMTP id e4mr176109999qhe.81.1452560643216; Mon, 11 Jan 2016 17:04:03 -0800 (PST)
In-Reply-To <e18786b7-c28a-45a8-8d8d-ad82cbd29ae3@googlegroups.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.20+
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>
Xref csiph.com comp.lang.python:101507

Show key headers only | View raw


Sorry, I should have been explicit. prob_dates (the actual argument of the
call) is a set. As far as I know pylint does no type inference, so pylint
can't tell if the LHS and RHS of the |= operator are appropriate, nor can
it tell if it has an update() method.

Before writing, I had more-or-less concluded I had hit a bug, but in my
experience when I hit something I think is a bug, it's not. It's me.
Terry's reply convinced me that I had hit something.

Something else just occurred to me. I should have tried disassembling the
two versions of the function. Here's the output near prob_dates.update()
call:

 14
​  ​
   62 LOAD_FAST                3 (prob_dates)
             65 LOAD_ATTR                6 (update)
             68 LOAD_GLOBAL              7 (compare_prices)
             71 LOAD_CONST               3 ('E:%s')
             74 LOAD_FAST                5 (sym)
             77 BINARY_MODULO
             78 LOAD_FAST                0 (cx1)
             81 LOAD_FAST                1 (cx2)
             84 LOAD_FAST                2 (cx3)
             87 CALL_FUNCTION            4
             90 CALL_FUNCTION            1

Here's how the |= version disassembles in that region:

 20
​  ​
     62 LOAD_FAST                3 (prob_dates)
             65 LOAD_GLOBAL              6 (compare_prices)
             68 LOAD_CONST               3 ('E:%s')
             71 LOAD_FAST                5 (sym)
             74 BINARY_MODULO
             75 LOAD_FAST                0 (cx1)
             78 LOAD_FAST                1 (cx2)
             81 LOAD_FAST                2 (cx3)
             84 CALL_FUNCTION            4
             87 INPLACE_OR
             88 STORE_FAST               3 (prob_dates)

I think what's throwing pylint is that last
​STORE_FAST. That tells pylint the argument is ignored.

I'll at least bring up the issue on the code-quality list.

Thanks,

Skip
​

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


Thread

I'm missing something here... Skip Montanaro <skip.montanaro@gmail.com> - 2016-01-11 17:26 -0600
  Re: I'm missing something here... sohcahtoa82@gmail.com - 2016-01-11 16:31 -0800
    Re: I'm missing something here... Skip Montanaro <skip.montanaro@gmail.com> - 2016-01-11 19:04 -0600
    Re: I'm missing something here... Ian Kelly <ian.g.kelly@gmail.com> - 2016-01-12 09:03 -0700
    Re: I'm missing something here... Skip Montanaro <skip.montanaro@gmail.com> - 2016-01-12 11:46 -0600

csiph-web