count strangeness

Chris Rebert crebert at ucsd.edu
Sun May 22 02:55:46 EDT 2011


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



More information about the Python-list mailing list