Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'subject:two': 0.07; 'latter': 0.09; 'lawrence': 0.09; 'lines.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'run,': 0.09; 'python': 0.11; 'bug': 0.12; 'language.': 0.14; 'delighted': 0.16; 'measured': 0.16; 'quest': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:based': 0.16; 'subject:key': 0.16; 'language': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'feb': 0.22; '>>>': 0.22; 'code,': 0.22; 'header:User-Agent:1': 0.23; 'tracker': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'code': 0.31; 'lines': 0.31; 'subject:per': 0.31; 'running': 0.33; 'subject:from': 0.34; 'no,': 0.35; 'subject:lists': 0.35; 'but': 0.35; 'raising': 0.36; 'reflect': 0.36; 'right?': 0.36; 'entry': 0.36; "i'll": 0.36; 'should': 0.36; 'to:addr:python- list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'changed': 0.39; 'received:org': 0.40; 'blank': 0.60; 'is.': 0.60; 'new': 0.61; 'course': 0.61; 'times': 0.62; "you've": 0.63; 'our': 0.64; 'charset:windows-1252': 0.65; 'line,': 0.68; 'containing': 0.69; '100': 0.79; 'counts': 0.83; '2015': 0.84; 'zen': 0.84; 'edwards': 0.91; 'minute.': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Create dictionary based of x items per key from two lists Date: Sun, 01 Feb 2015 18:49:35 +0000 References: <0dddee06-233b-436a-be48-3c16e62c1718@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-92-24-222-48.ppp.as43234.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422816602 news.xs4all.nl 2845 [2001:888:2000:d::a6]:44716 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85016 On 01/02/2015 18:14, Grant Edwards wrote: > On 2015-02-01, Chris Angelico wrote: >> On Sun, Feb 1, 2015 at 2:06 PM, Mark Lawrence wrote: >>> The one-liner might not be better code, but it must be better speed wise >>> precisely because it's on one line, right? :) >> >> Well of course it is. Python code speed is always measured in lines >> per minute. That's why you should eliminate blank lines from your >> code. > > No, you've got that backwards. You want _more_ blank lines. A blank > line takes zero time to run, but it still counts as a line in your > lines/second stats. > > A loop containing 1 line of code will execute in the same abount of > time as that loop with 1 line of code and 99 blanks lines. > > The latter loop is running at 100 times as many lines/second as the > former. That's _got_ to be better. > At long last my quest seeking the final entry for the Zen of Python is over. I'll be delighted to let you accept the honour of raising an issue on the bug tracker to get the "this" module changed to reflect my new found wisdom. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence