Posts

Showing posts with the label Machine Learning Artificial Intelligence

Python Namespaces

The structures used to arrange the symbolic names allocated to objects in a Python programme are covered in this tutorial. The relevance of objects in Python has been underlined in prior tutorials in this series. There are objects everywhere! Objects are the building blocks of everything your Python programme does. An assignment statement gives an object a symbolic name that can be used to refer to it. The statement x ='foo' generates a symbolic name x for the string object 'foo.'Hundreds or thousands of such names will be created in a software of any complexity, each pointing to a specific object. How does Python keep track of all these names and make sure they don't collide? A namespace in python is a set of currently specified symbolic names that includes information about the entity that each name refers to. A namespace can be thought of as a dictionary with the keys being the object names and the values being the objects themselves. Each key-value pair corresp