What is Namespace in python?

801    Asked by AswiniLobo in Data Science , Asked on Nov 12, 2019
Answered by Nitin Solanki

Whenever you define any object in python you give a name to that object so that you can use that name later to refer to that object. In python, there is a space that keeps all these names known as Namespace.

There are three types of namespace available in python:

Built-In Namespace

Global Namespace

Local Namespace

Built-In Namespace is always available in any session until we exit from the python interpreter.

Global Namespace is created by module and every module has its own namespace and these namespaces can collide with other modules as well.

Local Namespace is defined within a function and their scope is within that function only.




Your Answer

Interviews

Parent Categories