module trace and counts

R

rh

Is it for or range that is executed 8000 times when I
for i in range(3,8000,2):

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.
 
S

Steven D'Aprano

Is it for or range that is executed 8000 times when I for i in
range(3,8000,2):

I'm sorry, I don't understand that question.

Is it for what? What "it" are you talking about?

If you run the code:

for i in range(3, 8000, 2):
pass

the `for` statement executes once, giving 3999 iterations in total.
`range` gets executed once. Nothing is executed 8000 times.

Maybe the for and the range contributes to that total.

What total?

I'm sure the context of your question is obvious to you, but we're not
mind-readers and have no idea what you have done and what total you have
got. Please explain your question.
 
R

rh

I'm sorry, I don't understand that question.

Is it for what? What "it" are you talking about?

If you run the code:

for i in range(3, 8000, 2):
pass

the `for` statement executes once, giving 3999 iterations in total.
`range` gets executed once. Nothing is executed 8000 times.

I provided further info in another reply on this same thread.

But for sake of clarity and correctness here is what module trace
shows for a single pass:
4000: for i in range(3,8000,2):
3999: pass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top