Why doesn't this work ? For loop variable scoping ?

Aahz aahz at pythoncraft.com
Thu Mar 19 18:37:31 EDT 2009


In article <mailman.2240.1237501716.11746.python-list at python.org>,
Linuxguy123  <linuxguy123 at gmail.com> wrote:
>
>I've got a small piece of code that I don't understand.  Basically, a
>variable inside an if statement inside a for loop doesn't seem to be
>updating.  Is this a scope issue ?

Nope, it's a spelling issue.  I suggest you change your code to a more
readable:

newTemp += delta
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Programming language design is not a rational science. Most reasoning
about it is at best rationalization of gut feelings, and at worst plain
wrong."  --GvR, python-ideas, 2009-3-1



More information about the Python-list mailing list