First page Back Continue Last page Overview Graphics
Namespaces and Scopes
A namespace is a mapping from names to objects.
Namespaces are usually implemented in Python as dictionaries.
A scope is a textual region of a Python program where a namespace is directly accessible.
Scopes in Python:
- the innermost scope contains the local names
- the scope of an enclosing function
- the next-to-last scope contains the current
module's global names
- the outermost scope is the namespace
containing built-in names
Searched
for in this
order