A syntax question
joel.goldstick at gmail.com
Mon Nov 10 16:27:29 CET 2014
On Mon, Nov 10, 2014 at 9:54 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Tue, Nov 11, 2014 at 1:35 AM, Joel Goldstick
> <joel.goldstick at gmail.com> wrote:
>> Your problem is that count is not local. You are reading count from
>> an outer scope. When you try to increment count in your function, it
>> can't because it doesn't exist.
>> Don't use globals.
> False analysis, I'm afraid. The problem is that the assignment will,
> in the absence of a "global" declaration, cause the name "count" to
> indicate a local variable - so it won't ever be read from outer scope.
> However, the OP's issue is better solved by sharing tracebacks than by
> us peering into crystal balls; mine's showing a very clear image at
> the moment, but it might well be incorrect.
Interesting. Thanks for pointing that out
More information about the Python-list