November 2001
Beginner
320 pages
5h 53m
English
Modules in Python work in a slightly different way to Perl. We still import the modules, but modules can be imported in different ways, and once imported accessing the information within them is also different. However, if you've followed the notes so far on using Python objects and methods you'll begin to see a familiar pattern.
Python uses a very simple system for controlling the namespaces for importing modules. Python uses these namespaces in the same way as Perl uses packages (through the package statement). In Perl the package name for the main script is main and in Python —main—. The big difference between Perl and Python is how the namespaces affect how functions and objects in external modules are accessed.
In Perl, ...