Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108289
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Christopher Reimer <christopher_reimer@icloud.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Pylint prefers list comprehension over filter... |
| Date | Sat, 07 May 2016 12:37:20 -0700 |
| Lines | 23 |
| Message-ID | <mailman.467.1462649844.32212.python-list@python.org> (permalink) |
| References | <572BF2BF.6000000@icloud.com> <1462498631.232041.599637409.25D91C08@webmail.messagingengine.com> <mailman.422.1462498634.32212.python-list@python.org> <ngh0hu$4og$1@dont-email.me> <1462503446.248479.599683745.79791DAC@webmail.messagingengine.com> <572E43F0.6060501@icloud.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de 2l70OuKns0cr8qDBNmIFKgkaFTpa2vdXc6m9azgvMi9A== |
| 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.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'modified': 0.05; 'needed,': 0.05; 'subject:skip:c 10': 0.07; 'oh,': 0.09; 'python': 0.10; '2.7': 0.13; 'output': 0.13; 'thu,': 0.15; '2016': 0.16; 'list*': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'skips': 0.16; 'wrote:': 0.16; 'string': 0.17; 'copied': 0.18; '>>>': 0.20; 'do.': 0.22; 'stephen': 0.22; '(where': 0.23; 'examples': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'subject:list': 0.26; 'chris': 0.26; 'converting': 0.27; 'received:17': 0.27; '-0700,': 0.29; 'dan': 0.29; "i'm": 0.30; 'that.': 0.30; 'code': 0.30; 'received:10.0.0': 0.32; 'received:10.0': 0.34; 'list': 0.34; 'filter': 0.35; 'returning': 0.35; 'something': 0.35; "isn't": 0.35; 'but': 0.36; 'too': 0.36; 'list,': 0.36; 'should': 0.36; 'instead': 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'wanted': 0.37; 'difference': 0.38; 'building': 0.38; 'thank': 0.38; 'means': 0.39; "didn't": 0.39; 'build': 0.40; 'to:addr:python.org': 0.40; 'header:MIME-version:1': 0.60; 'your': 0.60; 'charset:windows-1252': 0.62; 'internet': 0.70; 'header:In- reply-to:1': 0.84; 'subject:over': 0.84; 'on?': 0.91 |
| X-Proofpoint-Virus-Version | vendor=fsecure engine=2.50.10432:,, definitions=2016-05-07_12:,, 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-1605070290 |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 |
| In-reply-to | <1462503446.248479.599683745.79791DAC@webmail.messagingengine.com> |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=4d515a; t=1462649841; bh=Nh+m7VNwX/8EBlzp93IDKdXWpZ4s8/YCGo4mjtS6Zng=; h=Subject:To:From:Message-id:Date:MIME-version:Content-type; b=LFrAvg+4VIPa8jn9+KVPMwROX9u4PiV7YGdRxugOL48MX3vvgXazZgASo8zPXtD6e qu5w4vDQoDS904r5n7QV+X7lgd3z+y0LO0h8G/Xg19ZQCOFzPkL6eMf1Hd7MQ1tmy+ kIz9j09hfrvJxovacJJSX8Vfnc1TakZNdKuN7RE8lv6jQ1oDCixKZ2MIXDdpg4IVO2 4968EFoOJ8sOc115tUI4AydgqgC1FLBMmLP5+Nbe6QtVsA4D8BJFHZiJVKFF9cKjRu 0/qMkdxd0hX6yCWK7yFm8hXHkpED0FzzsiyOx8DWkapwjPmzJUbj6PRCkcGivd2o7T qWY2IZ/l+stag== |
| 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 | <572E43F0.6060501@icloud.com> |
| X-Mailman-Original-References | <572BF2BF.6000000@icloud.com> <1462498631.232041.599637409.25D91C08@webmail.messagingengine.com> <mailman.422.1462498634.32212.python-list@python.org> <ngh0hu$4og$1@dont-email.me> <1462503446.248479.599683745.79791DAC@webmail.messagingengine.com> |
| Xref | csiph.com comp.lang.python:108289 |
Show key headers only | View raw
On 5/5/2016 7:57 PM, Stephen Hansen wrote: > On Thu, May 5, 2016, at 07:46 PM, Dan Sommers wrote: >> On Thu, 05 May 2016 18:37:11 -0700, Stephen Hansen wrote: >> >>> ''.join(x for x in string if x.isupper()) >>> The difference is, both filter and your list comprehension *build a >>> list* which is not needed, and wasteful. The above skips building a >>> list, instead returning a generator ... >> filter used to build a list, but now it doesn't (where "used to" means >> Python 2.7 and "now" means Python 3.5; I'm too lazy to track down the >> exact point(s) at which it changed): > Oh, didn't know that. Then again the OP was converting the output of > filter *into* a list, which wasted a list either way. My line of code was something I copied off the Internet and modified it until it did I exactly what I wanted it to do. That means that the many Python 2 code examples available on the Internet are using a redundant list operation with Python 3. Isn't that a "smell" that pylint should pick up on? Thank you, Chris R.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Pylint prefers list comprehension over filter... Stephen Hansen <me@ixokai.io> - 2016-05-05 18:37 -0700
Re: Pylint prefers list comprehension over filter... Dan Sommers <dan@tombstonezero.net> - 2016-05-06 02:46 +0000
Re: Pylint prefers list comprehension over filter... Chris Angelico <rosuav@gmail.com> - 2016-05-06 12:55 +1000
Re: Pylint prefers list comprehension over filter... Stephen Hansen <me+python@ixokai.io> - 2016-05-05 19:57 -0700
Re: Pylint prefers list comprehension over filter... Steven D'Aprano <steve@pearwood.info> - 2016-05-06 22:42 +1000
Re: Pylint prefers list comprehension over filter... Dan Sommers <dan@tombstonezero.net> - 2016-05-06 03:07 +0000
Re: Pylint prefers list comprehension over filter... Chris Angelico <rosuav@gmail.com> - 2016-05-06 13:18 +1000
Re: Pylint prefers list comprehension over filter... Christopher Reimer <christopher_reimer@icloud.com> - 2016-05-07 12:37 -0700
csiph-web