Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!hq-usenetpeers.eweka.nl!81.171.88.15.MISMATCH!eweka.nl!lightspeed.eweka.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail 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; 'case.': 0.05; 'frameworks': 0.05; 'lines.': 0.07; 'method,': 0.07; 'python': 0.09; 'counting': 0.09; 'path.': 0.09; 'sure,': 0.09; 'def': 0.10; 'language': 0.14; 'essential': 0.15; 'languages.': 0.15; 'aiming': 0.16; 'attention,': 0.16; 'c):': 0.16; 'code?': 0.16; 'indent': 0.16; 'kern': 0.16; 'merely': 0.16; 'readability.': 0.16; 'reasonably': 0.16; 'say.': 0.16; 'semicolon': 0.16; 'simpler,': 0.16; 'statement.': 0.16; 'wed,': 0.16; 'wrote:': 0.17; '(or': 0.18; 'code.': 0.20; 'to:name:python-list@python.org': 0.20; 'skip:- 40': 0.21; 'all,': 0.21; 'thanks.': 0.21; 'regardless': 0.21; 'exceptions': 0.22; 'sorry,': 0.22; "i'd": 0.22; 'for?': 0.23; 'statement': 0.23; 'to:2**1': 0.23; 'header:In-Reply-To:1': 0.25; 'bugs': 0.27; 'possibly': 0.27; '+0100': 0.27; 'first.': 0.27; 'strongly': 0.27; "doesn't": 0.28; 'correct': 0.28; 'lines': 0.28; 'perl': 0.29; 'steven': 0.29; 'date:': 0.29; 'url:mailman': 0.29; 'source': 0.29; 'stuff': 0.30; 'code': 0.31; 'url:python': 0.32; 'switch': 0.32; 'url:listinfo': 0.32; 'comments': 0.33; 'cases,': 0.33; 'from:addr:live.com': 0.33; 'to:addr:python-list': 0.33; 'likely': 0.33; 'produced': 0.33; 'another': 0.33; 'skip:d 20': 0.34; 'version': 0.34; 'agree': 0.34; 'nov': 0.35; 'principal': 0.35; 'robert': 0.35; 'especially': 0.35; 'open': 0.35; 'similar': 0.35; 'really': 0.36; 'subject:': 0.36; 'serve': 0.36; 'but': 0.36; 'url:org': 0.36; 'flow': 0.36; 'email addr:python.org': 0.36; 'two': 0.37; 'why': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'easier': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'easily': 0.39; 'url:mail': 0.40; 'think': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'bring': 0.62; 'email name:python-list': 0.62; 'skip:n 10': 0.63; 'choose': 0.65; 'treat': 0.65; 'teach': 0.69; 'introduce': 0.80; 'complexity': 0.84; 'excessive': 0.84; 'say:': 0.84; 'understand,': 0.84; 'besides,': 0.93; 'charset:windows-1251': 0.97 X-Originating-IP: [194.44.213.194] X-EIP: [IEc3OSsKsVPpUqlDLE2S62WCbuhUB7Fj] X-Originating-Email: [andriy.kornatskyy@live.com] From: Andriy Kornatskyy To: , "python-list@python.org" Subject: RE: Web Frameworks Excessive Complexity Date: Wed, 21 Nov 2012 14:09:38 +0300 Importance: Normal In-Reply-To: <67gun9-kk8.ln1@satorlaser.homedns.org> References: , , , , <50ac31dd$0$29987$c3e8da3$5496439d@news.astraweb.com>, <67gun9-kk8.ln1@satorlaser.homedns.org> Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 21 Nov 2012 11:09:38.0759 (UTC) FILETIME=[B2A45570:01CDC7D8] X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 84 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353496246 news.xs4all.nl 6889 [2001:888:2000:d::a6]:55652 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33715 We choose Python for its readability. This is essential principal of langua= ge and thousands around reading the open source code. Things like PEP8=2C C= C=2C LoC are all to serve you one purpose: bring your attention=2C teach yo= u make your code better. Thanks. Andriy ---------------------------------------- > From: ulrich.eckhardt@dominolaser.com > Subject: Re: Web Frameworks Excessive Complexity > Date: Wed=2C 21 Nov 2012 09:33:09 +0100 > To: python-list@python.org > > Am 21.11.2012 02:43=2C schrieb Steven D'Aprano: > > On Tue=2C 20 Nov 2012 20:07:54 +0000=2C Robert Kern wrote: > >> The source of bugs is not excessive complexity in a method=2C just > >> excessive lines of code. > > > > Taken literally=2C that cannot possibly the case. > > > > def method(self=2C a=2C b=2C c): > > do_this(a) > > do_that(b) > > do_something_else(c) > > > > > > def method(self=2C a=2C b=2C c): > > do_this(a)=3B do_that(b)=3B do_something_else(c) > > > > > > It *simply isn't credible* that version 1 is statistically likely to ha= ve > > twice as many bugs as version 2. Over-reliance on LOC is easily gamed= =2C > > especially in semicolon languages. > > "Don't indent deeper than 4 levels!" "OK=2C not indenting at all=2C $LANG > doesn't need it anyway." Sorry=2C but if code isn't even structured > halfway reasonably it is unmaintainable=2C regardless of what CC or LOC s= ay. > > > > Besides=2C I think you have the cause and effect backwards. I would rat= her > > say: > > > > The source of bugs is not lines of code in a method=2C but excessive > > complexity. It merely happens that counting complexity is hard=2C count= ing > > lines of code is easy=2C and the two are strongly correlated=2C so why = count > > complexity when you can just count lines of code? > > I agree here=2C and I'd go even further: Measuring complexity is not just > hard=2C it requires a metric that you need to agree on first. With LOC yo= u > only need to agree on not semicolon-chaining lines and how to treat > comments and empty lines. With CC=2C you effectively agree that an if > statement has complexity of one (or 2?) while a switch statement has a > complexity according to its number of cases=2C while it is way easier to > read and comprehend than a similar number produced by if statement. > Also=2C CC doesn't even consider new-fashioned stuff like exceptions that > introduce yet another control flow path. > > > >> LoC is much simpler=2C easier to understand=2C and > >> easier to correct than CC. > > > > Well=2C sure=2C but do you really think Perl one-liners are the paragon= of > > bug-free code we ought to be aiming for? *wink* > > Hehehe... =3B) > > Uli > > > -- > http://mail.python.org/mailman/listinfo/python-list =