Runtime and Context Modules

sys

Exposes interpreter-specific configuration and state, such as version_info, argv, streams and implementation metadata. sys.exit raises SystemExit rather than guaranteeing process termination. This example inspects interpreter version without changing global state.

Formal Syntax & Structure

python syntaxpython
import sys

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
import sysprint(sys.version_info.major == 3)
Python Reference