HiveBrain v1.2.0
Get Started
← Back to all entries
patternpythonCriticalCanonical

If Python is interpreted, what are .pyc files?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
interpretedarefilespycwhatpython

Problem

Python is an interpreted language. But why does my source directory contain .pyc files, which are identified by Windows as "Compiled Python Files"?

Solution

They contain byte code, which is what the Python interpreter compiles the source to. This code is then executed by Python's virtual machine.

Python's documentation explains the definition like this:

Python is an interpreted language, as
opposed to a compiled one, though the
distinction can be blurry because of
the presence of the bytecode compiler.
This means that source files can be
run directly without explicitly
creating an executable which is then
run.

Context

Stack Overflow Q#2998215, score: 783

Revisions (0)

No revisions yet.