40 Views

What are python namespaces in python language


srikarkandukuri467 24th Oct, 2021
Answer (1)
Nitin Mereddy 24th Oct, 2021

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

UPES Integrated LLB Admission...
Apply
Ranked #28 amongst Institutions in India by NIRF | Ranked #1 in India for Academic Reputation by QS University Rankings | 16.6 LPA Highest CTC
ICFAI-LAW School BA-LLB / BBA...
Apply
Ranked 1 st among Top Law Schools of super Excellence in India - GHRDC | NAAC A+ Accredited | #36 by NIRF
Great Lakes PGPM & PGDM 2025
Apply
Admissions Open | Globally Recognized by AACSB (US) & AMBA (UK) | 17.3 LPA Avg. CTC for PGPM 2024 | Application Deadline: 1st Dec 2024
Amity University, Noida Law A...
Apply
Admissions open for B.A. LL.B (Hons) , B.A. LL.B , BBA LL.B.(Hons) , B.Com.LL.B. (Hons.)
Jindal Global Law School Admi...
Apply
Ranked #1 Law School in India & South Asia by QS- World University Rankings | Merit cum means scholarships | Application Deadline: 31st Jan'25
ISBR Business School PGDM Adm...
Apply
180+ Companies | Highest CTC 15 LPA | Average CTC 8 LPA | Ranked as Platinum Institute by AICTE for 6 years in a row | Awarded Best Business School...
View All Application Forms

Download the Careers360 App on your Android phone

Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile

150M+ Students
30,000+ Colleges
500+ Exams
1500+ E-books