Namespace in Python and Variable scope.
Namespace in Python and Variable scope. This tutorial covers a comprehensive guide on namespaces, by the end of the tutorial you will learn various types of namespaces, and how to access them. Introduction Namespace is just like a container. It holds a set of names and links them to the corresponding objects. These names include variables, functions, classes and or any other identifier. Namespaces are important because they help us organize and manage our code by providing a unique space for each identifier thus preventing conflict in naming. Types of namespaces In Python programming language, there are four types of namespaces: Local namespace Global Namespace Built-in Namespace Enclosing Namespace a). Local Namespace These are a set of names that are within a specific function or method. They are limited to the function and Method in which they have been defined. Local namespaces are created when a function that has all the names define...