Re: module trace and counts

2012-11-17 Thread Dave Angel
On 11/17/2012 08:30 PM, Steven D'Aprano wrote: > 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. > Off

Re: module trace and counts

2012-11-17 Thread Steven D'Aprano
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. Off by one. py> len(range(3, 8000, 2)) 3999 -- Steven -

Re: module trace and counts

2012-11-17 Thread Dave Angel
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, neither the for nor the range is executed multiple times. Deciphering this depends on whether this is Python 2.

Re: module trace and counts

2012-11-17 Thread Steven D'Aprano
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` s