Why does this UnboundLocalError occur (closure)?
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Melt
--
Chapters
00:00 Question
00:23 Accepted answer (Score 211)
01:16 Answer 2 (Score 94)
01:58 Answer 3 (Score 30)
02:46 Answer 4 (Score 7)
03:19 Thank you
--
Full question
https://stackoverflow.com/questions/9264...
Accepted answer links:
[scope]: http://docs.python.org/3.3/tutorial/clas...
[[1]]: http://docs.python.org/3.3/faq/programmi...
[UnboundLocalError]: http://docs.python.org/3.3/library/excep...
[[2]]: http://docs.python.org/3.3/faq/programmi...
[global]: http://docs.python.org/3.3/reference/sim...
[nonlocal]: http://docs.python.org/3.3/reference/sim...
Answer 2 links:
[global statement]: http://docs.python.org/py3k/reference/si...
[nonlocal statement]: http://docs.python.org/py3k/reference/si...
Answer 3 links:
[nonlocal]: https://docs.python.org/3/reference/simp...
Answer 4 links:
[itertools.count()]: http://docs.python.org/library/itertools...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #scope #closures #globalvariables
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Melt
--
Chapters
00:00 Question
00:23 Accepted answer (Score 211)
01:16 Answer 2 (Score 94)
01:58 Answer 3 (Score 30)
02:46 Answer 4 (Score 7)
03:19 Thank you
--
Full question
https://stackoverflow.com/questions/9264...
Accepted answer links:
[scope]: http://docs.python.org/3.3/tutorial/clas...
[[1]]: http://docs.python.org/3.3/faq/programmi...
[UnboundLocalError]: http://docs.python.org/3.3/library/excep...
[[2]]: http://docs.python.org/3.3/faq/programmi...
[global]: http://docs.python.org/3.3/reference/sim...
[nonlocal]: http://docs.python.org/3.3/reference/sim...
Answer 2 links:
[global statement]: http://docs.python.org/py3k/reference/si...
[nonlocal statement]: http://docs.python.org/py3k/reference/si...
Answer 3 links:
[nonlocal]: https://docs.python.org/3/reference/simp...
Answer 4 links:
[itertools.count()]: http://docs.python.org/library/itertools...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #scope #closures #globalvariables
#avk47