Python Program File Structure
Python Program Files#
This type of Python files contains a series of pre-written statements called "modules".
Modules that can be directly executed are usually called scripts (i.e., the top-level files of a program).
Python programs can be decomposed into modules, statements, expressions, and objects#
Programs are composed of modules.
Modules contain statements.
Statements contain expressions.
Expressions create and manipulate objects.
- Expressions are "something", while statements are "do something" (i.e., instructions);
- For example, "3+4" is something, while the statement "print 3+4" is doing something;
- Characteristics of statements: they change things. For example, an assignment statement changes a variable, a print statement changes the screen output, etc.
Procedural and Object-Oriented#
Procedural:
- Instruction-centered, with instructions processing data. It is about how to organize code to solve problems.
Object-Oriented:
- Data-centered, with all processing code revolving around data. It is about designing data structures to organize data and providing operations to manipulate such data.