Namespaces are a way to divide cluster resources between multiple users or teams. They provide a scope for names, allowing you to have multiple objects with the same name in different namespaces.
xxxxxxxxxx
We can think of namespace as you made a private space for your variables or
functions so that ther cann't be any condition where you can find name
collision of variable or function a program.
I found out a great article on tutorialspoint and would definitely suggest you
all to go there to have a better understanding of namespaces.
https://www.tutorialspoint.com/cplusplus/cpp_namespaces.htm
A namespace is used to group and, on some levels, isolate resources in a Kubernetes cluster. The names of resources must be unique in their namespaces, but not between namespaces.
xxxxxxxxxx
Imagine your Python code as a house, and the namespaces are like different rooms in that house.
The Built-in Namespace:
This is like the basement of the house - it's always there and contains all the basic tools and utilities everyone needs, like the print function or the math functions. You can access these tools from any room in the house.
The Global Namespace:
This is like the main living room of the house - it's the central space where everyone gathers and shares common stuff. This is where you define global variables that everyone in the house can access, like the name of the family or the TV remote.
Local Namespaces:
These are like bedrooms or individual workspaces in the house. Each room can have its own set of things that only the people in that room know about, like clothes in a bedroom or specific tools in a workshop. These are local variables or functions defined inside functions, only accessible within that specific function.
Using Names without Qualification:
It's like asking for something without specifying its location. If you're inside your bedroom and ask for your book, everyone assumes you mean the book you keep in your room. Similarly, when you use a name without any dots or references, the Python interpreter looks for it in the current room (local namespace) first. If it's not found there, it checks the main living room (global namespace) and finally the basement (built-in namespace).