O'Reilly logo
  • Sridhar Bulusu thinks this is interesting:

Code in your main Python program (and within IDLE’s shell) is associated with a namespace called __main__. When you put your code into its own module, Python automatically creates a namespace with the same name as your module. So, the code in your module is associated with a namespace called nester.

From

Cover of Head First Python

Note

What do they mean by "Code in your main Python program" mean? When we have to write python code, we do that in a .py file. So, the code automatically belongs to the name space of the .py file, not the main namespace. So, where does this main name space come into picture?