Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: I'm missing something here... Date: Tue, 12 Jan 2016 09:03:24 -0700 Lines: 49 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de VbtpyflhN3Jv+AnDd4i05woLS5KyC0h6AWfBbMwJDXZg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'received:209.85.223': 0.03; 'method.': 0.05; 'subject:missing': 0.07; 'wrong,': 0.09; 'jan': 0.11; 'output': 0.13; 'argument': 0.15; '2016': 0.16; 'bug,': 0.16; 'call)': 0.16; 'lhs': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rhs': 0.16; 'something.': 0.16; 'wrote:': 0.16; 'skip': 0.18; 'tells': 0.18; 'versions': 0.20; '(the': 0.22; 'sorry,': 0.22; 'ignored.': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'not.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'actual': 0.28; 'looks': 0.29; 'occurred': 0.29; "can't": 0.32; 'received:google.com': 0.35; 'set.': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'version': 0.38; 'received:209': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'believe': 0.66; 'reply': 0.68; 'to:name:python': 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:from:date:message-id:subject:to :content-type; bh=ZwwOD1TSZSdDrHVmY4cjaUsFXCdajhaEGXcByCr599U=; b=nPqiBq1l74QygcPcuydQHq6f2sBCJeA006NhhAMUD0Sy3qd4ka3sLP44KlKi3yQwob vUkn5FpSHfD5VYZ+WVf/AxYr6UM0TLl1PF4P3gVQa5ZFMK8vFuOXGDOLoJ7bTH93Mpx5 u1AO61uFeY1DZCuqgXS6hydvEQTC2gSiBLNwNOc659w9AKgS288BrbHVpQVEfev7aPjE id2wRij5cHWFar81optGJbaVIh1X7khSa/xtjunCOffLZiRl1JR/FW6kpxnvkdgJX2UH TnuNZDLaSqeu6DB8L04zLs+DfLOuL7qk/VRBHBNJfPaqjvpJRTBfnn1peyrWMUuVOrt4 VGdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=ZwwOD1TSZSdDrHVmY4cjaUsFXCdajhaEGXcByCr599U=; b=Fatc1kammz8jaISH9aEToEy5ADVipo0ub1TjFt+ti4UJ5C06bOfm/+FQAThIv0aeGK sbB2He9C/2b2go+Z5mYXbWGDUJmQqSTgxoqSCrU/BHxCU0dQUYDRNBzXnw5H9B0sGsUL 40nTe6q8kJUPUcJvic/PIadTneQtb/DdRfuQ12CfvCgadQAZtfj66t4luzbVlVE+OA9D 7Z/8yGxBZKH2W/tFP8ca9FjmodL0ZVX46Wlvow+P75KXUZbP1gvYOScErYiIYaGOBnvG SnNNM1+TkLsDdtk57rrKKGrorVpc1et+Vb4fq6bfKtoMvbDAMGA34ZTznG268LqkeLce gknw== X-Gm-Message-State: ALoCoQlNeSPONpgwjLxEQW7u2Cb7LOPTAosyCk1CvZmEGHpnc6B3NpMg7Mho3brST3ubKmoBNyBVVcsJ+SVQBk5GyX7MlffQfg== X-Received: by 10.107.185.6 with SMTP id j6mr116728547iof.111.1452614643855; Tue, 12 Jan 2016 08:04:03 -0800 (PST) In-Reply-To: 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: , Xref: csiph.com comp.lang.python:101548 On Mon, Jan 11, 2016 at 6:04 PM, Skip Montanaro 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.