Why nested functions can access variables from outer functions, but are not allowed to modify them [duplicate]
Why nested functions can access variables from outer functions, but are not allowed to modify them [duplicate] python
python
The problem and a solution to it, for Python 2.x as well, are given in this post. Additionally, please read PEP 3104 for more information on this subject.