Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101503
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Terry Reedy <tjreedy@udel.edu> |
| Newsgroups | comp.lang.python |
| Subject | Re: I'm missing something here... |
| Date | Mon, 11 Jan 2016 19:36:26 -0500 |
| Lines | 51 |
| Message-ID | <mailman.31.1452559005.13488.python-list@python.org> (permalink) |
| References | <CANc-5Uw6M7p9bLXhpET=6wdQz=vA-veDps_L-Q98utzYcs9+sg@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de 6353JL2UVoR6+2EUtEHikQMHz/fzPqtOugYHxTZFocVQ== |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'skip:[ 20': 0.03; 'subject:missing': 0.07; 'complaining': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'bug': 0.10; 'python': 0.10; 'jan': 0.11; 'def': 0.13; 'argument': 0.15; '"test"': 0.16; "'b',": 0.16; "'c',": 0.16; "'e',": 0.16; 'correctly,': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'set()': 0.16; 'true:': 0.16; 'wrote:': 0.16; 'skip': 0.18; 'code,': 0.23; 'bit': 0.23; 'slightly': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'equivalent': 0.27; 'skip:# 10': 0.27; 'sets.': 0.29; 'skip:s 30': 0.31; 'run': 0.33; 'something': 0.35; 'should': 0.36; 'cases': 0.36; 'received:71': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'skip:p 20': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'treat': 0.72; 'prompt': 0.79; '6:26': 0.84; 'dumb': 0.84; 'received:fios.verizon.net': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | pool-71-185-227-36.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
| In-Reply-To | <CANc-5Uw6M7p9bLXhpET=6wdQz=vA-veDps_L-Q98utzYcs9+sg@mail.gmail.com> |
| 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:101503 |
Show key headers only | View raw
On 1/11/2016 6:26 PM, Skip Montanaro wrote:
> 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?
A bug in pylint. It should treat both cases the same.
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: I'm missing something here... Terry Reedy <tjreedy@udel.edu> - 2016-01-11 19:36 -0500
csiph-web