Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Stephen Hansen Newsgroups: comp.lang.python Subject: Re: pylint woes Date: Sat, 07 May 2016 20:46:58 -0700 Lines: 37 Message-ID: References: <1462673665.770286.601202553.071593AE@webmail.messagingengine.com> <1462679218.789727.601235065.67122D8D@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 0LXQ6/Px6MFRyljRwPLQSgzINEAKLmiaSnu2AXuEIvfg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:internal': 0.09; 'python': 0.10; 'read.': 0.13; '"insert': 0.16; 'at,': 0.16; 'at.': 0.16; 'dfs': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'simpler,': 0.16; 'skip:z 30': 0.16; 'vals': 0.16; 'written.': 0.16; 'wrote:': 0.16; 'names.': 0.22; 'stephen': 0.22; 'sat,': 0.23; "haven't": 0.24; 'header:In-Reply-To:1': 0.24; 'idea': 0.28; 'values': 0.28; 'be:': 0.29; 'code': 0.30; 'guess': 0.31; 'addresses': 0.32; 'are:': 0.32; 'lists': 0.34; 'that,': 0.34; 'list': 0.34; 'but': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'beyond': 0.37; 'received:66': 0.38; 'version': 0.38; 'wrong': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'space': 0.40; 'avoid': 0.61; 'header :Message-Id:1': 0.61; 'more': 0.63; 'matter.': 0.66; 'skip:n 40': 0.72 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=ixokai.io; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=9dEGS28c7CrPXafHCujn7TrVovs=; b=OhoGoI 3xcOOYQebdhpZ5qVoX6KM2SMEO6RaOb5whD3zSq7RrqJQubVkAbnl+GpAqgMhcKy /Fd4hAOaZ6YmYsh8CByxau5yK/0SBjknSLPFlVMB7IkX29v3nIVkmlgX3vSA6rYR BQn7irxjF9IrldQv/kt/NskFBnHPWWGtGTEw0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=9dEGS28c7CrPXaf HCujn7TrVovs=; b=bNGtP+7DARnMsovEJ6oUBQyexnmA8aCd9nmlrj1IeNHpE9v YspNQ58vNKTS6oyPxR4WuNjQCu+lHfGxIsJWr+yiBIQ+TeHbLZJFNTZjOgdCROUi boWzLup3/wqmbHqBYlqjlkDeiSGE47v+YFSY34Syreo3efGNb+f+NiSiRl3s= X-Sasl-Enc: rkZTlilz6fYWYZ6oTsRy6R5ZruwA7Y1ELLp6dNEyr0s4 1462679218 X-Mailer: MessagingEngine.com Webmail Interface - ajax-140377c4 In-Reply-To: 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: <1462679218.789727.601235065.67122D8D@webmail.messagingengine.com> X-Mailman-Original-References: <1462673665.770286.601202553.071593AE@webmail.messagingengine.com> Xref: csiph.com comp.lang.python:108330 On Sat, May 7, 2016, at 08:04 PM, DFS wrote: > The lists I actually use are: > > for j in range(len(nms)): > cSQL = "INSERT INTO ADDRESSES VALUES (?,?,?,?,?)" > vals = nms[j],street[j],city[j],state[j],zipcd[j] > > > The enumerated version would be: > > ziplists = zip(nms,street,city,state,zipcd) > for nm,street,city,state,zipcd in ziplists: > cSQL = "INSERT INTO ADDRESSES VALUES (?,?,?,?,?)" > vals = nm,street,city,state,zipcd > > > I guess the enumeration() is a little nicer to look at. Why do you > think it's more maintainable? Code is read more then its written. That which is nicer to look at, therefore, is easier to read. That which is easier to read is easier to maintain. Beyond that, its simpler, and more clearly articulates in the local space what's going on. > Aside: I haven't tried, but is 'names' a bad idea or illegal for the > name of a python list or variable? Nothing wrong with names. Or 'name', for that matter. Try to avoid abbreviations. -- Stephen Hansen m e @ i x o k a i . i o