Understand Scope in Python

Will Button
InstructorWill Button

Share this video with your friends

Send Tweet

Misunderstanding scope can cause problems in your application. Watch this lesson to learn how Python scope works and the hidden implications it presents. Local scope, nonlocal scope, and global scope variables are demonstrated and explained.

Falk
Falk
~ 2 years ago

In the first global variable example in the transcript the wrong function is used, I.e. def global_groot(name):

Raunaq Sahni
Raunaq Sahni
~ 2 years ago

If you're new to scopes and would like to visualise them, try running the code in this lesson on this website: http://www.pythontutor.com. This helps visualise each frame aka scope existing in a program i.e. global, functionA, functionB, etc.