Firstly let me clarify that I know C and am learning Python. So my OOPS is kind of bad.
I was reading the official tutorial and found this
Although scopes are determined statically, they are used dynamically. At any time during execution, there are at least three nested scopes whose namespaces are directly accessible:
- the innermost scope, which is searched first, contains the local names
- the scopes of any enclosing functions, which are searched starting with the nearest enclosing scope, contains non-local, but also non-global names
- the next-to-last scope contains the current module’s global names the outermost scope (searched last) is the namespace containing built-in names
I understand namespaces. I think scopes are the same thing. But I couldn't figure out what does the sentence about scopes mean? What is the advantage of such an arrangement?
I understand the sentence but couldn't visualize that. So please don't say that this is problem with my English.