Python Glossary Русский

Python 3.3+systerm

sys.implementation

information

Details of the Python implementation: name ('cpython', 'pypy'), the implementation version and cache_tag for .pyc.

Syntax

sys.implementation.name

Python is a language with several implementations, and sys.version_info states the language version, not who runs it. sys.implementation.name tells CPython, PyPy and others apart, which is how interpreter-specific quirks are worked around. cache_tag is part of the file names in __pycache__, e.g. 'cpython-314'.

Examples

import sys
print(sys.implementation.name)  # → ? cpython у стандартного интерпретатора
print(sys.implementation.cache_tag)  # → ? например cpython-314
print(sys.implementation.version.major)  # → 3

See also

Open in the full glossarydocs.python.orgReport an inaccuracy