Working with Modules
Dan Stanzione (TACC) (original author), Steve Lantz, Adam Brazier, Chris Myers
Cornell Center for Advanced Computing
Revisions: 5/2024, 7/2021, 8/2016, 10/2014, 2/2014, 3/2013, 6/2010 (original)
Modules are collections of Python code that are bundled together in a common namespace, and which are brought into the Python interpreter via the import
keyword. Modules can include class and function definitions, data, and executable Python code. Much of the functionality that the Python ecosystem offers is not built-in by default in the interpreter, but can be imported from either the Python Standard Library or from the huge collection of third-party packages available online. The terms "module", "package", and "library" are sometimes used interchangeably, but module
is actually the type of the Python object representing the collective namespace and its contents that are imported.
Objectives
After you complete this segment, you should be able to:
- List and understand common modules available in the Python standard library
- Interface with community modules for scientific computing
Prerequisites
This workshop assumes the reader has no prior exposure to Python. A working knowledge of UNIX/Linux and general programming concepts is assumed. The target audience is scientists and engineers using high performance computing systems who wish to boost their productivity through the use of Python.