In the variable explorer, the namespace content (all global object references) of the current console can be seen. A function can access all variables in the namespace content, without explicitly passing them as function arguments.
I'd say this is pretty much correct, although lacking.
It is correct when it says a function has accesses to all of the programs global names. If Python cannot find a name used in the current local scope, it assumes the name is global and will attempt to retrieve its value from there.
However, one point the above definition does not mention is builtin names. They are always accessible at any point in the program anywhere.
Usually, only the arguments passed to the function are in your environment. Variables not passed as arguments are not necessarily available.
I'd disagree with the claim made that only variables passed in as arguments are part of the functions local scope (a.k.a environment). If a variable is not declared global using the global
or nonlocal
statements, any variable created in a functions local scope belongs to that scope and can be accessed throughout that scope.