I&C SCI 32 Lecture Notes - Lecture 3: Local Variable, Global Variable, Eval
Document Summary
Can use eval() or exec() to run text files as python programs. Split programs into separate files of a practical size. A python module is a file with a name ending in . py that contains a collection of definitions. A function, a constant, or a class. A running python program might have a very large number of names that it knows: The names of variables, functions, parameters, constants, classes, and so on. Local variable - belong to a particular call to a particular function. Every time the function return, its parameters and local variables are destroyed, so subsequent calls to functions are unaffected. Namespaces are used by python to differentiate between the names that are local to one function and the names that are local to another. Think of it as a dictionary that maps names to the objects that have those names.