Suppose I have the following python code:
def outer(): string = \"\" def inner(): string = \"String was changed by a nested function!\" i
You can also get around this by using function attributes:
def outer(): def inner(): inner.string = "String was changed by a nested function!" inner.string = "" inner() return inner.string
Clarification: this works in both python 2.x and 3.x.