What are SCOPES and NAMESPACES in Python?

Scope is all about the location and the scale of things and their life span. And namespaces are the mechanism to achieve this in Python. In this tutorial you learn how scopes an namespaces work, how variables are resolved, how to make namespaces and why the global and nonlocal keywords can be dangerous. C H A P T E R S 0:25 Scopes v.s. Namespaces 0:45 Global scope 2:15 Function scope 2:50 Python name resolving 3:30 Built-in scope 4:50 Namespace with modules 6:35 Enclosing namespace 8:24 Modify out of scope 10:25 Global and nonlocal cause side effects #closure #scope #namespace