Python Glossary Русский

all Python 3platformfunction

platform.python_implementation()

interpreter

The name of the Python implementation: 'CPython', 'PyPy', 'IronPython' or 'Jython'.

Syntax

platform.python_implementation()

This replaces java_ver(), removed in 3.15: to learn what the code runs on, ask for the implementation instead of probing for Java. sys.implementation.name gives the same answer in machine form, but lower-case: 'cpython' versus 'CPython', so comparing the two without lower() fails.

Examples

import platform, sys
print(platform.python_implementation())  # → CPython
print(sys.implementation.name)  # → cpython
print(platform.python_implementation().lower() == sys.implementation.name)  # → True

See also

Open in the full glossarydocs.python.orgReport an inaccuracy