Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33490

Re: module trace and counts

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.042
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'executed': 0.07; 'python': 0.09; 'closed.': 0.09; 'subject:module': 0.09; 'cc:addr:python- list': 0.10; 'sat,': 0.15; '2))': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.17; '>>>': 0.18; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "d'aprano": 0.29; 'steven': 0.29; 'starts': 0.29; 'checked': 0.30; 'figure': 0.30; 'times.': 0.33; 'another': 0.33; 'nov': 0.35; 'pm,': 0.35; 'but': 0.36; 'should': 0.36; 'subject:: ': 0.38; 'nothing': 0.38; 'instead': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'range': 0.60; 'first': 0.61; 'times': 0.63; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; '08:30': 0.84; 'received:74.208.4.194': 0.84; 'mistake': 0.91; 'angel': 0.93
Date Sat, 17 Nov 2012 21:54:31 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
MIME-Version 1.0
To Steven D'Aprano <steve+comp.lang.python@pearwood.info>
Subject Re: module trace and counts
References <20121117092502.12c53a8f48072cd249108b47@lavabit.com> <mailman.3777.1353177465.27098.python-list@python.org> <50a83a40$0$29978$c3e8da3$5496439d@news.astraweb.com>
In-Reply-To <50a83a40$0$29978$c3e8da3$5496439d@news.astraweb.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:n/iwfOMFFONEp+Jke79YQmn+A5zJaNHNLRHa0/ydKM/ Hps3Bj4Ff/5DAE3ASMMLrfcDtTww6unHfChqZcuFPb4So3GZ7r lqbMpUj+594iiN4srCp+zDMmygI/ERKHoeiQPy7SG+nzCMvXvg wIHNgQp8lhozzjNKew0lBVf7cMs98v7pS4SCtbw3WKlFvrgUDQ jB+hWQIlVvY8Kp5FkAmfyZBeyS4WMtun6IsCulkpYDFzW7mlEE iQO6m55vAF1LOEqiF3SeW6PXWRF5p6g5R82PVMq89gkJ0fgpe+ AijLTjrK7El4E73RfJw0TwfR5xsfmCSZSw2Bu/tSz8ZvpxGwA= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To d@davea.name
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3784.1353207300.27098.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1353207300 news.xs4all.nl 6874 [2001:888:2000:d::a6]:34777
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33490

Show key headers only | View raw


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 by one.
>
> py> len(range(3, 8000, 2))
> 3999
>
>
I should have actually let Python figure it.  Instead I knocked off one
because the interval is half-open, and another because it starts at 3. 
Then I checked it by subtracting the first from the last and dividing by
2  ( (7999-3)/2 ), but then made the stupid mistake of not adding one
because my interval WAS closed.



-- 

DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: module trace and counts Dave Angel <d@davea.name> - 2012-11-17 13:37 -0500
  Re: module trace and counts Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-18 01:30 +0000
    Re: module trace and counts Dave Angel <d@davea.name> - 2012-11-17 21:54 -0500

csiph-web