Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33485
| From | rh <richard_hubbe11@lavabit.com> |
|---|---|
| Subject | Re: module trace and counts |
| Date | 2012-11-17 13:30 -0800 |
| References | <mailman.3772.1353173085.27098.python-list@python.org> <50a7cdce$0$29978$c3e8da3$5496439d@news.astraweb.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3781.1353187781.27098.python-list@python.org> (permalink) |
On 17 Nov 2012 17:47:58 GMT Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > 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. 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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
module trace and counts rh <richard_hubbe11@lavabit.com> - 2012-11-17 09:25 -0800
Re: module trace and counts Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-17 17:47 +0000
Re: module trace and counts rh <richard_hubbe11@lavabit.com> - 2012-11-17 13:30 -0800
csiph-web