Namespace In Python

2 min readDec 4, 2021


A python namespace is a system that has a unique name for each and every object in Python. An object might be a variable or a system. Python itself maintains a namespace in the form of a Python wordbook. Let’s go through an illustration, a directory- train system structure in computers. Dispensable to say, that bone can have multiple directories having a train with the same name inside every directory. But one can get directed to the train, one wishes, just by specifying the absolute path to the train.
Real- time illustration, the part of a namespace is like a surname. One might not find a single “ Alice” in the class there might be multiple “ Alice” but when you particularly ask for “ Alice Lee” or “ Alice Clark” (with a surname), there will be only one ( time being do n’t suppose of both first name and surname are same for multiple scholars).

On analogous lines, the Python practitioner understands what exact system or variable bone is trying to point to in the law, depending upon the namespace. So, the division of the word itself gives a little further information. Its Name (which means name, a unique identifier) Space (which talks commodity related to compass). Then, a name might be of any Python system or variable and space depends upon the position from where is trying to pierce a variable or a system.

Types of namespaces

When Python practitioner runs solely without any stoner- defined modules, styles, classes, etc. Some functions like print (), id () are always present, these are erected-in namespaces. When a stoner creates a module, a global namespace gets created, latterly the creation of original functions creates the original namespace. The erected-in namespace encompasses the global namespace and the global namespace encompasses the original namespace.

InsideAIML is the platform where you learn codings of AI.