I&C SCI 32 Lecture Notes - Lecture 3: Local Variable, Global Variable, Eval

41 views2 pages

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents