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


Groups > comp.lang.python > #101497

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 I'm missing something here...
Date Mon, 11 Jan 2016 17:26:53 -0600
Lines 47
Message-ID <mailman.26.1452554821.13488.python-list@python.org> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de UorKQZZNbai+Ka/0Q3Ngcgt1DZVaEyGSGX2aXLw/tXDw==
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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'skip:[ 20': 0.03; 'subject:missing': 0.07; 'complaining': 0.09; 'python': 0.10; 'def': 0.13; 'argument': 0.15; '"test"': 0.16; "'b',": 0.16; "'c',": 0.16; "'e',": 0.16; 'correctly,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'set()': 0.16; 'true:': 0.16; 'skip': 0.18; '>>>': 0.20; 'code,': 0.23; 'bit': 0.23; 'slightly': 0.23; 'import': 0.24; 'equivalent': 0.27; 'skip:# 10': 0.27; 'message-id:@mail.gmail.com': 0.27; 'sets.': 0.29; 'skip:s 30': 0.31; 'run': 0.33; 'received:google.com': 0.35; 'something': 0.35; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'received:209': 0.38; 'skip:p 20': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'prompt': 0.79; 'dumb': 0.84; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=iXW+13DQPK50QI0ypyCR3bYvNl3JZsKLieypQnB/aKI=; b=pjEtdfXkg8lqtAbMcS0DNVkcvjroN8vcR66zH6D1uU/dI1tdrs4INSN+FG1ljo0iRn xRUzYEoUproaMPUX1M9mziE/9SDyyLnMrVH06vOTfr/O4r++TDB/eB5RzgbvHyvuDsde EH/0cYEoWPdzeezJ1SKeLXZ+xt77LTkbdH5Jj2JMqulxdaElft0l2sKPrcXHKq3A7ILS nroYB/mpOzSINvpkH5iAsuG980pV43NHdt20SQP9yBiA3yFi+TneA2jF+wyRb5d2zuLf GZG9xllrYo3DVABb2gz+05G0sS2TbarSfbLLo8b/ksLdUj8YTOYNIRonZrqgOOX0VumZ xaxA==
X-Received by 10.140.32.194 with SMTP id h60mr165534684qgh.79.1452554813669; Mon, 11 Jan 2016 15:26:53 -0800 (PST)
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:101497

Show key headers only | View raw


Here's a dumb little bit of code, adapted from a slightly larger script:

#!/usr/bin/env python

"dummy"

import glob
import os

def compare_prices(*_args):
    "dummy"
    return set()

def find_problems(cx1, cx2, cx3, prob_dates):
    "dummy"
    for fff in sorted(glob.glob("/path/to/*.nrm")):
        sym = os.path.splitext(os.path.basename(fff))[0]
        prob_dates |= compare_prices("E:%s"%sym, cx1, cx2, cx3)

When I run pylint against it, it complains:

junk.py:10: [W0613(unused-argument), find_problems] Unused argument 'prob_dates'

I must be misunderstanding something about the |= operator as applied
to sets. If I read the docs correctly, s1 |= s2 is equivalent to
s1.update(s2). A dumb "test" at the prompt suggests that's true:

>>> s1 = set("abc")
>>> s2 = set("cde")
>>> s1 | s2
set(['a', 'c', 'b', 'e', 'd'])
>>> s1 |= s2
>>> s1
set(['a', 'c', 'b', 'e', 'd'])
>>> s1 = set("abc")
>>> s1.update(s2)
>>> s1
set(['a', 'c', 'b', 'e', 'd'])

If I change the last line of find_problems to call
prob_dates.update(), the message disappears. Why is pylint (1.4.2 BTW)
complaining that the prob_dates argument of find_problems is unused
when I use the |= operator?

Thx,

Skip

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