Global and nonlocal keywords can be dangerous.

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.

Written by Loek van den Ouweland on 2024-03-15.
Questions regarding this artice? You can send them to the address below.