6/30/22

Python Namespaces

 A namespace is a collection of names and the details of the objects that the names refer to.

Python has three main types of namespaces:

  1. Built-In 
  2. Global
  3. Local

BUILT-IN NAMESPACE
This contains all the python built-in objects and is always accessible, i.e., you don't need to import it to use it.
An example is the print and input function.

GLOBAL NAMESPACE
This is a collection of global modules that can be accessed within a python project once imported.

LOCAL NAMESPACE
This namespace are declared by the programmer and can only be accessed within the project.


Blog Archive