Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108205
| Path | csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Christopher Reimer <christopher_reimer@icloud.com> |
| Newsgroups | comp.lang.python |
| Subject | Pylint prefers list comprehension over filter... |
| Date | Thu, 05 May 2016 18:26:23 -0700 |
| Lines | 24 |
| Message-ID | <mailman.420.1462497989.32212.python-list@python.org> (permalink) |
| References | <572BF2BF.6000000@icloud.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de do7XxtkO5WYzugxOzquVIA/PO98zNQ5v6XUnbxNjMrPA== |
| Return-Path | <christopher_reimer@icloud.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.042 |
| X-Spam-Evidence | '*H*': 0.92; '*S*': 0.00; 'subject:skip:c 10': 0.07; "skip:' 30": 0.15; 'disabled.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'thread.': 0.16; 'string': 0.17; 'header :User-Agent:1': 0.26; "doesn't": 0.26; 'subject:list': 0.26; 'chris': 0.26; 'earlier': 0.27; 'received:17': 0.27; 'correct': 0.28; 'fine': 0.28; 'code': 0.30; 'received:10.0.0': 0.32; 'except': 0.34; 'received:10.0': 0.34; 'list': 0.34; 'replaced': 0.35; 'according': 0.36; 'to:addr:python-list': 0.36; 'received:10': 0.37; 'thank': 0.38; 'does': 0.39; 'skip:x 10': 0.40; 'to:addr:python.org': 0.40; 'header:MIME-version:1': 0.60; 'greetings,': 0.61; 'subject:over': 0.84 |
| X-Proofpoint-Virus-Version | vendor=fsecure engine=2.50.10432:,, definitions=2016-05-05_15:,, signatures=0 |
| X-Proofpoint-Spam-Details | rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1605060012 |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=4d515a; t=1462497979; bh=YF2BaMakfc0rBrh1YgOjWN6VRZUOr3ShSLe0JIT6WzQ=; h=To:From:Subject:Message-id:Date:MIME-version:Content-type; b=hxY5LFa1MT8gXls26+17711CnCSCoKpCA4kgZCviHyfVf4wOICHYxxl/uxXHJwsFF OR5Fl1cWsSLBhAdJo6CDtj/K5sUJqcWt2+anbZ46hhknzxN54KL9s0QmwBRP0Fkmvo gwHEEof0fEGRT2xAOIav+47NwZwUVcuFUqsu91iN6caC8Em2Aq9b3HSC6qRbwM37gf Vc83OWGU3Yj9TfL6+PrY8/iPeoG+ueaxMOvaZNRBf0/cpWCtQ3hXB++3EG3a+Ycm8I QUWvbTLtTYxvaPTRHGpx5IEkydCBMDSx4KNOMAdpgQsvCxpZqOFYh/0XIWjjGOdsAy 81oDGW1zjiu2A== |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| 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> |
| X-Mailman-Original-Message-ID | <572BF2BF.6000000@icloud.com> |
| Xref | csiph.com comp.lang.python:108205 |
Show key headers only | View raw
Greetings,
Below is the code that I mentioned in an earlier thread.
string = "Whiskey Tango Foxtrot"
''.join(list(filter(str.isupper, string)))
'WTF'
That works fine and dandy. Except Pylint doesn't like it. According to
this link, list comprehensions have replaced filters and the Pylint
warning can be disabled.
http://stackoverflow.com/questions/3569134/why-doesnt-pylint-like-built-in-functions
Here's the replacement code using list comprehension:
''.join([x for x in string if x.isupper()])
Which is one is correct (Pythonic)? Or does it matter?
Thank you,
Chris R.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Pylint prefers list comprehension over filter... Christopher Reimer <christopher_reimer@icloud.com> - 2016-05-05 18:26 -0700
csiph-web