What are Python namespaces?
- Naveen
- 0
A namespace In Python refers to the name which is assigned to each object in Python. The objects are variables and functions. As each object is created, its name along with space (the address of the outer function in which the object is), gets created.
The namespaces are maintained in Python like a dictionary where the key is the namespace and value is the address of the object. There are 4 types of namespaces in python:
- Built-in namespace
These namespaces contain all the built-in objects in python and are available whenever python is running.
- Global namespace
These are namespaces for all the objects created at the level of the main program.
- Enclosing namespaces
These namespaces are at the local or inner function.
Popular Posts
Author
-
Naveen Pandey has more than 2 years of experience in data science and machine learning. He is an experienced Machine Learning Engineer with a strong background in data analysis, natural language processing, and machine learning. Holding a Bachelor of Science in Information Technology from Sikkim Manipal University, he excels in leveraging cutting-edge technologies such as Large Language Models (LLMs), TensorFlow, PyTorch, and Hugging Face to develop innovative solutions.
View all posts