Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.032 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; '21,': 0.09; 'loop.': 0.09; 'pm,': 0.10; '>>>': 0.12; 'wrote:': 0.14; '1024': 0.16; 'rebert': 0.16; 'received:209.85.213.174': 0.16; 'received:mail- yx0-f174.google.com': 0.16; 'cc:addr:python-list': 0.17; 'meant': 0.18; 'cheers,': 0.19; 'header:In-Reply-To:1': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'message-id:@mail.gmail.com': 0.28; 'sat,': 0.29; 'cc:addr:python.org': 0.30; '"why': 0.30; 'rather': 0.34; 'question': 0.34; 'chris': 0.34; 'there': 0.35; 'explicit': 0.35; 'received:132': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.37; 'assuming': 0.37; 'received:209.85.213': 0.37; 'but': 0.38; 'subject:: ': 0.38; 'case,': 0.39; 'should': 0.39; 'received:209': 0.39; 'more': 0.60; 'your': 0.60; '10.': 0.65; 'believe': 0.66; 'cause': 0.67; '11,': 0.68; 'mere': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ucsd.edu; i=crebert@ucsd.edu; q=dns/txt; s=041709-iport; t=1306047358; x=1337583358; h=mime-version:in-reply-to:references:date:message-id: subject:from:to:cc; z=MIME-Version:=201.0|In-Reply-To:=20|References:=20=0D=0A =09 =0D=0A=09|Date:=20Sat,=2021 =20May=202011=2023:55:46=20-0700|Message-ID:=20|Subject: =20Re:=20count=20strangeness|From:=20Chris=20Rebert=20|To:=20James=20Stroud=20|Cc:=20python-list@python.org; bh=1Jmqr3+5Z60eTOyQIBpSNMRIzUG2zEy9zcBiL68c1TI=; b=qAvb0L6sVXu/Zogfm/dQ3HL3zEHVtfL6q6POMq+b6DAHp3SmQI+R7z4q 9lpxhDLl/+pOklRPC7EUdwaBLDmgNcjJXNLPeVpFViuSuE0sLpTFMF1ZS sLekDb9P76a5La/+ikL1zhXedCaee5X9WJ6h3Y9AkUrduG8u+edgCIhI5 c=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao0FADuy2E2E7/kU/2dsb2JhbACEXKE8CHioRYtfhkuIdIErg2eBBwSGUIlBhCGGZDuDAFU X-IronPort-AV: E=Sophos;i="4.65,251,1304319600"; d="scan'208";a="522384596" X-Spam-Status: No X-Spam-Level: MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 21 May 2011 23:55:46 -0700 Subject: Re: count strangeness From: Chris Rebert To: James Stroud Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 26 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306047359 news.xs4all.nl 49041 [::ffff:82.94.164.166]:56591 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5963 On Sat, May 21, 2011 at 11:32 PM, James Stroud wrote: > Chris Rebert wrote: >>> >>> WTF? >> >> Assuming your question is "Why is 1024 there twice?", the answer is > > The question is "Why is 1024 there at all?" It should be 10. Ah. This is why it's better to be more explicit about what your question is than a mere "WTF?". In that case, I believe you meant to write: count += c.doit() rather than: count += c.doit(count) Recall that count is continually increasing as you go through your loop. Although you'll then get 11, not 10, but the cause of that is obvious (`count += 1`). Cheers, Chris -- http://rebertia.com