On 3/17/2010 11:44 AM, Emile van Sebille wrote:
On 3/17/2010 8:16 AM Michael Sparks said...
Hi,
Is the following behaviour expected ?
In short, yes. Assignment within a function forces the variable to
locals.
In 3.x, one can declare names to be nonlocal (ie, local to some outer
function, as opposed to local to the current function or module global).
In your case,
nonlocal on
in your inner swtchfun function would give the behavior you wanted.
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list