Back in Section 2.2, “The assignment statement”, we first encountered the idea of a namespace. When you start up Python in conversational mode, the variables and functions you define live in the “global namespace”.
We will see later on that Python has a number of different namespaces in addition to the global namespace. Keep in mind that namespaces are very similar to dictionaries:
The names are like the keys of a dictionary: each one is unique.
The values bound to those names are like the values in a dictionary. They can be any value of any type.
We can even use the same picture for a dictionary that we use to illustrate a namespace. Here is a small dictionary and a picture of it:
d = { 'name': 'Ben Jones', 'front9': 33, 'back9': 31 }
