image
image
image

Namespace in Python

image

When we start the Python interpreter, a namespace containing all inbuilt names is created as long the workspace remains application is active. Inbuilt functions such as print() and id() exist throughout the program.

Built-in Namespace: These are functions, methods, and associated data that immediately accessible as soon the Python interpreter loads and as such are accessible to each instance and area of the workspace.

Global Namespace: This involves the contents of a module that are accessible throughout the module. Modules can have several functions and methods.

Local Namespace: Mostly for user-defined functions, a local namespace is restricted to the particular function and outside the function access is not implicitly possible.