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


Groups > comp.lang.python > #101548

Re: I'm missing something here...

From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: I'm missing something here...
Date 2016-01-12 09:03 -0700
Message-ID <mailman.67.1452614646.13488.python-list@python.org> (permalink)
References <mailman.26.1452554821.13488.python-list@python.org> <e18786b7-c28a-45a8-8d8d-ad82cbd29ae3@googlegroups.com> <CANc-5Uxm_D2KcPWdHNuYUxx3iBacgbG1WAYgfvH0-6ScoE7A_Q@mail.gmail.com>

Show all headers | View raw


On Mon, Jan 11, 2016 at 6:04 PM, Skip Montanaro
<skip.montanaro@gmail.com> wrote:
> 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 may be wrong, but I believe pylint just looks at the AST, not the opcodes.

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