Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33484 > unrolled thread

Re: module trace and counts

Started byrh <richard_hubbe11@lavabit.com>
First post2012-11-17 13:19 -0800
Last post2012-11-17 13:19 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: module trace and counts rh <richard_hubbe11@lavabit.com> - 2012-11-17 13:19 -0800

#33484 — Re: module trace and counts

Fromrh <richard_hubbe11@lavabit.com>
Date2012-11-17 13:19 -0800
SubjectRe: module trace and counts
Message-ID<mailman.3780.1353187155.27098.python-list@python.org>
On Sat, 17 Nov 2012 13:37:23 -0500
Dave Angel <d@davea.name> 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 <module>.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
> 


-- 

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web