The Python Oracle

Why isn't the 'global' keyword needed to access a global variable?

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: Hypnotic Orient Looping

--

Chapters
00:00 Question
00:57 Accepted answer (Score 431)
02:06 Answer 2 (Score 253)
02:31 Answer 3 (Score 89)
03:40 Answer 4 (Score 61)
04:58 Thank you

--

Full question
https://stackoverflow.com/questions/4693...

Question links:
[UnboundLocalError on local variable when reassigned after first use]: https://stackoverflow.com/questions/3703...
[Using global variables in a function]: https://stackoverflow.com/questions/4233.../

Answer 2 links:
[binding]: http://docs.python.org/reference/executi...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #globalvariables

#avk47