Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: MRAB Newsgroups: comp.lang.python Subject: Re: Simple exercise Date: Mon, 14 Mar 2016 15:57:42 +0000 Lines: 42 Message-ID: References: <99e0c48c-862b-479e-9b86-3282b16ed56d@googlegroups.com> <9d987940-5635-4b43-912a-df4696cc2ca3@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 5CbZ5vOrNPskcPyWoitkfgiMzAsgoBJ+aHJ3wNXNwh8w== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'correct.': 0.07; 'adopted': 0.09; "ain't": 0.09; 'subtle': 0.09; 'term,': 0.09; 'thrown': 0.09; 'worse': 0.09; 'wrong,': 0.09; 'python': 0.10; ':-)': 0.12; 'read.': 0.13; 'times,': 0.13; '"bad': 0.16; '"code': 0.16; '"external"': 0.16; '"mark': 0.16; '"zip': 0.16; '2016': 0.16; 'blindly': 0.16; 'bugs.': 0.16; 'folks,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'personally,': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; "someone's": 0.16; 'wrote:': 0.16; 'explicit': 0.22; 'programming': 0.22; 'code,': 0.23; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'helpful': 0.27; 'community.': 0.27; 'possibility': 0.27; '14,': 0.27; 'sequence': 0.27; 'function': 0.28; 'sure,': 0.29; 'code': 0.30; 'becomes': 0.30; 'received:84': 0.32; 'hell': 0.33; 'instances': 0.33; 'subject:Simple': 0.33; 'python.org': 0.35; 'could': 0.35; 'something': 0.35; 'but': 0.36; 'too': 0.36; 'should': 0.36; 'there': 0.36; 'monday,': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'johnson': 0.37; 'mean': 0.38; 'sure': 0.39; 'does': 0.39; 'received:192': 0.39; 'well.': 0.40; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'term': 0.60; 'your': 0.60; 'decision': 0.61; 'avoid': 0.61; 'necessarily': 0.63; 'within': 0.64; 'march': 0.64; 'choose': 0.68; 'dangerous': 0.70; 'peers,': 0.84; 'scarlet': 0.84; 'adopt': 0.91; 'habit': 0.91; 'technically': 0.91; 'rick': 0.93 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=bsGxfxui c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IkcTkHD0fZMA:10 a=8AHkEIZyAAAA:8 a=QnmkSkDtzoVmyef2u5IA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <9d987940-5635-4b43-912a-df4696cc2ca3@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104830 On 2016-03-14 15:22, Rick Johnson wrote: > On Monday, March 14, 2016 at 9:19:04 AM UTC-5, alister wrote: >> A code smell does not necessarily mean the code is wrong, >> just that it warrants investigation as there is a strong >> possibility it may be sub- optimal > > Yes, technically speaking, you're correct. > > But the concept of "code smell" has become something of a > scarlet letter within the programming community. Once you > apply it to someone's code, the stigma becomes very > difficult to rub off -- and not just the "external" stigma > you feel radiating from scornful stares of your peers, but > the "self-imposed" stigma as well. It has become a > derogatory term, and sadly, one that is thrown around much > too carelessly. > > Sure, there are legitimate instances where the term should > be applied, but in the case of "zip vs explicit sequence > indexing", the usage of this term could influence a "less > experienced Python programmer", to adopt a very dangerous > habit *SIMPLY* because he does not want to be labeled a "bad > programmer". But the irony is, he may produce worse code by > blindly reaching for his "sequence zipper"! > > The zip function is not something you should get in the > habit of using without first considering the consequences of > *EACH SPECIFIC USE-CASE*. Yes, it can be helpful at times, > and yes, it can make code easier to read. But it can also > create subtle bugs. Personally, i choose to avoid it, but > others should make the decision for themselves. > > In a nutshell, the zip function is both "elegantly powerful" > and "cunningly destructive". So buyer beware. Because, > Python.org ain't no Walmart folks, and they sure as hell > don't give refunds for sequence members that evaporated into > the ether, after you adopted the bad habit of using zip, > simply because -> "Mark said so"! > In other words, code is like cheese. Some of it smells, even when there's nothing wrong. :-)