Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'output': 0.04; 'method.': 0.05; '-0500': 0.07; 'executed': 0.07; 'python': 0.09; 'loop.': 0.09; 'page?': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'throws': 0.09; 'times,': 0.13; 'sat,': 0.15; '2.7.3': 0.16; 'contributes': 0.16; 'executed,': 0.16; 'invocations': 0.16; 'iterated': 0.16; "module's": 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.17; 'module': 0.19; 'bit': 0.21; '2.x': 0.22; '3.x': 0.22; 'trace': 0.22; 'runs': 0.22; 'insert': 0.23; "haven't": 0.23; 'command': 0.24; 'tried': 0.25; 'header:User-Agent:1': 0.26; 'object,': 0.27; 'options': 0.27; 'header:X-Complaints-To:1': 0.28; 'maybe': 0.29; 'figure': 0.30; 'gets': 0.32; 'running': 0.32; 'turns': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'times.': 0.33; 'changed': 0.34; 'thanks': 0.34; 'list': 0.35; 'nov': 0.35; 'pm,': 0.35; 'too.': 0.35; 'received:org': 0.36; 'tool': 0.36; 'but': 0.36; 'depends': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'two': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'nothing': 0.38; 'page': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'end': 0.40; 'range': 0.60; 'profile': 0.61; 'times': 0.63; 'special': 0.73; 'counts': 0.81; 'confusion.': 0.84; 'received:sd.cox.net': 0.84; 'resulted': 0.84; 'items,': 0.91; 'angel': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: rh Subject: Re: module trace and counts Date: Sat, 17 Nov 2012 13:19:42 -0800 References: <20121117092502.12c53a8f48072cd249108b47@lavabit.com> <50A7D963.5060801@davea.name> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: ip68-6-43-149.sb.sd.cox.net User-Agent: dsodnetnin X-Mailer: EZnn0.37p X-Newsreader: EZnn0.37p X-Gmane-NNTP-Posting-Host: EZnn0.37p Original-Received: from slem by 1.1 with local X-No-Archive: yes Archive: no X-Archive: expiry=11 X-Archive: encrypt X-Operating-System: Barebones_6.1 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: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353187155 news.xs4all.nl 6913 [2001:888:2000:d::a6]:49522 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33484 On Sat, 17 Nov 2012 13:37:23 -0500 Dave Angel wrote: > On 11/17/2012 12:25 PM, rh wrote: > > Is it for or range that is executed 8000 times when I > > for i in range(3,8000,2): > Nothing is executed 8000 times. I figure it at 3998 times. Anyway, It turns out that trace accumulates data across invocations and so two runs resulted in the 8000 I saw. I also have since changed what happens inside the loop. I am running module trace from the command line and the options and the output cause confusion. Here's the bit from module trace: "-c, --count Count the number of times each line is executed and write the counts to .cover for each module executed, in the module's directory." > neither the for nor the range is executed multiple times. Deciphering > this depends on whether this is Python 2.x or Python 3.x. > > If Python 2.x, range returns a list of 3998 items, and that is > iterated over. Yes I have 2.7.3 > If Python 3.x, range returns a range object, which has an __iter__() > special method. That method gets called 3999 times, and the last time > it throws an exception to end the loop. Interesting I haven't tried 3.x Thanks for the help! > > > > > Maybe the for and the range contributes to that total. > > > > Can anyone recommend their favorite trace or profile type tool that > > spits out an html page? I like trace because I don't have to insert > > my program into it but would like a html page too. > > > > > -- > > DaveA > --