- Every object in Python functions within a scope.
- A scope is a block of code where an object in Python remains relevant.
- Namespaces uniquely identify all the objects inside a program.
- However, these namespaces also have a scope defined for them where you could use their objects without any prefix.
- A few examples of scope created during code execution in Python are as follows:
1.A local scope refers to the local objects available in the current function.
2.A global scope refers to the objects available throught the code execution since their inception.
3.A module-level scope refers to the global objects of the current module accessible in the program.
4.An outermost scope refers to all the built-in names callable in the program. The objects in this scope are searched last to find the name referenced.