Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Christopher Reimer Newsgroups: comp.lang.python Subject: Re: pylint woes Date: Sat, 07 May 2016 11:52:23 -0700 Lines: 32 Message-ID: References: <572E3967.9060206@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 CFYR3OKYX4CZxJAb8zTXvgBgY/HCUNHi/1sRugc0QzpA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'assigning': 0.09; 'broken.': 0.09; 'ide': 0.09; 'python': 0.10; 'index': 0.13; 'times,': 0.13; 'background,': 0.16; 'dfs': 0.16; 'gonna': 0.16; 'iterating': 0.16; 'non-trivial': 0.16; 'program?': 0.16; 'pythonic': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'routinely': 0.16; 'throwaway': 0.16; 'wrote:': 0.16; 'pointed': 0.18; 'variable': 0.18; 'java': 0.22; 'programming': 0.22; 'am,': 0.23; 'code.': 0.23; 'header:User-Agent:1': 0.26; 'chris': 0.26; 'figure': 0.27; 'received:17': 0.27; 'values': 0.28; 'code': 0.30; 'anyone': 0.32; 'received:10.0.0': 0.32; 'says': 0.32; 'useful': 0.33; 'received:10.0': 0.34; 'list': 0.34; 'behind': 0.35; 'could': 0.35; 'possible,': 0.35; 'something': 0.35; "isn't": 0.35; 'should': 0.36; 'instead': 0.36; 'tool': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'thank': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'header :MIME-version:1': 0.60; 'ever': 0.60; 'charset:windows-1252': 0.62; 'better.': 0.66; 'fall': 0.66; 'walk': 0.72; 'gotten': 0.76; 'habits.': 0.84; 'header:In-reply-to:1': 0.84; 'post,': 0.84 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-1605070279 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 In-reply-to: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=4d515a; t=1462647144; bh=GmO5heS9NWmI6AX/G9PUFINb3dgnuqYShkoyb5wGzl4=; h=Subject:To:From:Message-id:Date:MIME-version:Content-type; b=dDdqyx7+OaiTH1D2Au4rxNQhPVBpKe6YSSu+C29qhG4mmPVSLuyp+mXegz81xMJkd /zw2sjw3QVJXdGMDgOLGrHi4xAvVHrOkjunDM4IFi3oS91h1/YBNxH/X5ioqEqu+3H B/Dqo05gFjt46aSX+3rdpa7Ix2QxpSLM/ehTNpnnII6No9Sy5NLLIU1t0wHd8b4f+N cfTChkEllBPuOnkcbEseSjQkpCYsw0Rz1yBTP84T0Idqs49qJxjjs8el3MfQi4cGYO 1hCvskyraSwuOT5N4DrSlacvMGMp69MGFQldLlSN4z55p5otDAOcsJZRBF8nzFvi3H Rx9VCJHmAaOcQ== X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <572E3967.9060206@icloud.com> X-Mailman-Original-References: Xref: csiph.com comp.lang.python:108282 On 5/7/2016 9:51 AM, DFS wrote: > Has anyone ever in history gotten 10/10 from pylint for a non-trivial > program? I routinely get 10/10 for my code. While pylint isn't perfect and idiosyncratic at times, it's a useful tool to help break bad programming habits. Since I came from a Java background, I had to unlearn everything from Java before I could write Pythonic code. It might help to use an IDE that offers PEP8-compliant code suggestions (I use PyCharm IDE). > That's about as good as it's gonna get! You can do better. You should strive for 10/10 whenever possible, figure out why you fall short and ask for help on the parts that don't make sense. > pylint says "Consider using enumerate instead of iterating with range > and len" > > the offending code is: > for j in range(len(list1)): > do something with list1[j], list2[j], list3[j], etc. This code is reeking with bad habits to be broken. Assigning a throwaway variable to walk the index is unnecessary when Python can do it for you behind the scenes. As Chris A. pointed out in his post, you should use zip() to walk through the values of each list at the same time. Thank you, Chris R.