June 2002
Beginner to intermediate
640 pages
14h 24m
English
Code blocks are pieces of executable Python code that you can think of as collections of statements. Modules, classes, and functions are all examples.
Modules may be scripts that execute only once. Since Python is unlike other languages in its lack of a main method, it starts executing code (program text) from the top of the module. To re-execute the module, you have to reload it.
Modules can contain classes and functions (both code blocks), which may be executed many times. Also, functions can contain classes as well as other functions, and classes can contain methods as well as other classes. Variables defined in a code block are associated with that code block's namespace.
The Main BlockPython may not have a main ... |
Read now
Unlock full access