Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython
by Richard Hightower
Modules
Without defining them, we've been using modules since Chapter 1. These are files that contain Python statements and definitions (classes and functions) and can be imported into other modules or into the main module. Module files are identified by the suffix .py.
If you're a programmer coming from a Java background, you may think that a module is similar to a package. Once you work with Python modules for a while, you may think of them more as a cross between a package and a final public class (with all static variables and a private constructor).
Import
The import statement allows you to import classes, functions, and variables from one module into the current module's namespace. Table 5-1 describes its forms. Here is an example module, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access