Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'url:sourceforge': 0.03; 'algorithm': 0.04; 'friday,': 0.09; 'lawrence': 0.09; 'cc:addr :python-list': 0.11; 'cc:name:python list': 0.16; 'comments:': 0.16; 'wrote:': 0.18; 'code.': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'read,': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'dec': 0.30; 'robert': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'lines': 0.31; 'subject:some': 0.31; 'anyone': 0.31; 'fri,': 0.33; 'december': 0.35; 'tool': 0.35; "who's": 0.35; 'received:google.com': 0.35; 'there': 0.35; 'largely': 0.36; 'performance': 0.37; 'pm,': 0.38; 'does': 0.39; 'john': 0.61; 'here': 0.66; 'below.': 0.71; 'detecting': 0.84; 'to:addr:yahoo.co.uk': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=K2pQ6u51xnFi+ULNYplnad6HBW4d66U5eTxh1QjvKKE=; b=h9zu+gH/6fmwuWBnQceM8buQ2IGKirRC4moEdoAwclzaBvOyc16V0phKaT198vu9/6 otdwXfBosv9gmW8b8fpd4ElmWaNuJh2tlNkKUtN9duurkEHNd+X8fI7KGc4cvlq9ATuM 6VQnlDSl4q7OeY0FAiBzfuuZwAeaP2sdPj8bKcXmkbMsI5FaDjYsklbFHnBM6uk+DW3i TH9WVCTlwP0AZQ+Vkwkdw3yaVT9e6P3nd5lZ4rSOcSZpNNfVmFtGWUqLczjh1i8TbomK QgCs5T/V35WA60AFSj1x3nimRlY7m4+/wm+XGr6K6z0wXbIBUsXVVL1EZ+1A0GO8+U1p LRDw== MIME-Version: 1.0 X-Received: by 10.194.84.72 with SMTP id w8mr24330223wjy.55.1386370909967; Fri, 06 Dec 2013 15:01:49 -0800 (PST) In-Reply-To: References: <9df6ccd7-828d-43be-ac49-fe1c6a38bae7@googlegroups.com> Date: Fri, 6 Dec 2013 15:01:49 -0800 Subject: Re: squeeze out some performance From: Dan Stromberg To: Mark Lawrence Content-Type: multipart/alternative; boundary=047d7bea40ba9d9bab04ece5a1cd Cc: Python List 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: 75 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386370917 news.xs4all.nl 2945 [2001:888:2000:d::a6]:46084 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61189 --047d7bea40ba9d9bab04ece5a1cd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Dec 6, 2013 at 2:38 PM, Mark Lawrence wrot= e: > On 06/12/2013 16:52, John Ladasky wrote: > >> On Friday, December 6, 2013 12:47:54 AM UTC-8, Robert Voigtl=E4nder wrot= e: >> >> I try to squeeze out some performance of the code pasted on the link >>> below. >>> http://pastebin.com/gMnqprST >>> >> >> Several comments: >> >> 1) I find this program to be very difficult to read, largely because >> there's a whole LOT of duplicated code. Look at lines 53-80, and lines >> 108-287, and lines 294-311. It makes it harder to see what this algorit= hm >> actually does. Is there a way to refactor some of this code to use some >> shared function calls? >> >> > A handy tool for detecting duplicated code here > http://clonedigger.sourceforge.net/ for anyone who's interested. > Pylint does this too... --047d7bea40ba9d9bab04ece5a1cd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

= On Fri, Dec 6, 2013 at 2:38 PM, Mark Lawrence <breamoreboy@yahoo.co.= uk> wrote:
On 06/12/2013 16:52, John = Ladasky wrote:
On Friday, December 6, 2013 12:47:54 AM UTC-8, Robert Voigtl=E4nder wrote:<= br>
I try to squeeze out some performance of the code pasted on the link below.=
http://pastebin.= com/gMnqprST

Several comments:

1) I find this program to be very difficult to read, largely because there&= #39;s a whole LOT of duplicated code. =A0Look at lines 53-80, and lines 108= -287, and lines 294-311. =A0It makes it harder to see what this algorithm a= ctually does. =A0Is there a way to refactor some of this code to use some s= hared function calls?


A handy tool for detecting duplicated code here http://clonedigger.sourceforge.net/<= /a> for anyone who's interested.

--047d7bea40ba9d9bab04ece5a1cd--