module trace and counts

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Nov 17 18:47:58 CET 2012


On Sat, 17 Nov 2012 09:25:02 -0800, rh wrote:

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


-- 
Steven


More information about the Python-list mailing list