Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'executed': 0.07; 'executes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sake': 0.09; 'subject:module': 0.09; 'sat,': 0.15; '2):': 0.16; 'correctness': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'thread.': 0.16; 'wrote:': 0.17; 'module': 0.19; 'question.': 0.20; 'sorry,': 0.22; 'trace': 0.22; 'statement': 0.23; 'pass': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; "d'aprano": 0.29; 'once,': 0.29; 'once.': 0.29; 'steven': 0.29; "i'm": 0.29; 'gets': 0.32; 'info': 0.32; 'to:addr:python-list': 0.33; 'code:': 0.33; 'times.': 0.33; 'another': 0.33; 'nov': 0.35; 'received:org': 0.36; 'but': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'nothing': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'range': 0.60; 'further': 0.61; 'times': 0.63; 'here': 0.65; 'reply': 0.66; 'talking': 0.66; 'about?': 0.84; 'pass:': 0.84; 'received:sd.cox.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: rh Subject: Re: module trace and counts Date: Sat, 17 Nov 2012 13:30:09 -0800 References: <50a7cdce$0$29978$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: ip68-6-43-149.sb.sd.cox.net User-Agent: dsodnetnin X-Mailer: EZnn0.37p X-Newsreader: EZnn0.37p X-Gmane-NNTP-Posting-Host: EZnn0.37p Original-Received: from slem by 1.1 with local X-No-Archive: yes Archive: no X-Archive: expiry=11 X-Archive: encrypt X-Operating-System: Barebones_6.1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353187781 news.xs4all.nl 6901 [2001:888:2000:d::a6]:52767 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33485 On 17 Nov 2012 17:47:58 GMT Steven D'Aprano 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