57 Views
What are python namespaces in python language
Answer (1)
A Python namespace ensures that object names in a program are unique and can be used without any conflict. Python implements these namespaces as dictionaries with ‘name as key’ mapped to its respective ‘object as value’.
Let’s explore some examples of namespaces:
- Local Namespace consists of local names inside a function. It is temporarily created for a function call and gets cleared once the function returns.
- Global Namespace consists of names from various imported modules/packages that are being used in the ongoing project. It is created once the package is imported into the script and survives till the execution of the script.
- Built-in Namespace consists of built-in functions of core Python and dedicated built-in names for various types of exceptions.
Related Questions
what is pep8 in python language
84 Views
What kind of language is Python?
8 Views
Shoolini University Admission...
Apply
NAAC A+ Grade | Ranked No.1 Private University in India (QS World University Rankings 2025)
Amity University Noida B.Tech...
Apply
Among Top 30 National Universities for Engineering (NIRF 2024) | 30+ Specializations | AI Powered Learning & State-of-the-Art Facilities
Graphic Era (Deemed to be Uni...
Apply
NAAC A+ Grade | Among top 100 universities of India (NIRF 2024) | 40 crore+ scholarships distributed