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


Groups > comp.lang.python > #5963

Re: count strangeness

References <ira8ti$6no$1@dont-email.me> <mailman.1903.1306045726.9059.python-list@python.org> <iraam0$dfi$1@dont-email.me>
Date 2011-05-21 23:55 -0700
Subject Re: count strangeness
From Chris Rebert <crebert@ucsd.edu>
Newsgroups comp.lang.python
Message-ID <mailman.1907.1306047359.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, May 21, 2011 at 11:32 PM, James Stroud <jstroud@mbi.ucla.edu> 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

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


Thread

count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:02 -0700
  Re: count strangeness Chris Rebert <crebert@ucsd.edu> - 2011-05-21 23:27 -0700
    Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:32 -0700
      Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:39 -0700
      Re: count strangeness Chris Rebert <crebert@ucsd.edu> - 2011-05-21 23:55 -0700
        Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-22 00:03 -0700
  Re: count strangeness Peter Otten <__peter__@web.de> - 2011-05-22 08:31 +0200
    Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:34 -0700
      Re: count strangeness Peter Otten <__peter__@web.de> - 2011-05-22 09:13 +0200
    Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:56 -0700
  Re: count strangeness Roy Smith <roy@panix.com> - 2011-05-22 09:36 -0400

csiph-web