source code
Source code, sometimes just called “source” or “code”, consists of human-readable computer instructions written by programmers. It’s the original form of a computer program, before it’s translated into a form that a machine can run. In Python, source code is compiled into bytecode, the internal representation that the Python virtual machine executes.
Here’s an example of some source code written in Python:
example.py
def do_twice(func):
def wrapper_do_twice(*args, **kwargs):
func(*args, **kwargs)
func(*args, **kwargs)
return wrapper_do_twice
@do_twice
def greet(name):
print(f"Hello, {name}!")
When programmers talk about “reading the source” or “checking the source code,” they mean examining these original, human-readable program files. The source code represents the authoritative version of how a program works and contains all the implementation details of its functionality.
Related Resources
Tutorial
How to Run Your Python Scripts and Code
Learn how to run Python scripts from the command line, REPL, IDEs, and file managers on Windows, Linux, and macOS. Master all execution approaches.
For additional information on related topics, take a look at the following resources:
- Your Guide to the CPython Source Code (Tutorial)
- Python Code Quality: Best Practices and Tools (Tutorial)
- How to Write Beautiful Python Code With PEP 8 (Tutorial)
- Python Logging: A Stroll Through the Source Code (Tutorial)
- How to Run a Python Script (Course)
- How to Run Your Python Scripts (Quiz)
- Your Guide to the CPython Source Code (Quiz)
- Managing and Measuring Python Code Quality (Course)
- Python Code Quality: Best Practices and Tools (Quiz)
- Writing Beautiful Pythonic Code With PEP 8 (Course)
- How to Write Beautiful Python Code With PEP 8 (Quiz)
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Dan Bader • Updated Sept. 23, 2026