top of page
Search
techskill065

Namespace in Python



In this article, we will discuss about the Namespaces in Python. A namespace is a group of presently defined emblematic names along with information about the object that each name references. You can suppose a namespace as a guide by which the keys are the object names and the values are the objects themselves. Each key-value brace maps a name to its matching object. Local namespace A local namespace is defined for a class, a function, a circle, or any block of law. The names defined in a block of law or a function are local to it. The variable names can not be penetrated outside the block of law or the function in which they're defined. The local namespace is set up when the block of law or the function starts executing and terminates when the function or the block of law terminates. The conception of the local namespace can be understood from the following illustration. myNum1 = 100 myNum2 = 100 def add(num1, num2): temp = num1 + num2 return temp Built-in Namespace A built-in namespace has the names of built-in functions and objects. It's created while starting the python practitioner, exists as long as the practitioner runs, and is destroyed when we close the practitioner. It includes the names of built-in data types, exceptions, and functions like print () and input (). we hope you liked articles and found it informative.


1 view0 comments

Comments


Post: Blog2_Post
bottom of page