36. pycache and Compiled Files
Python compiles .py files into bytecode .pyc files for faster execution.
Where Are They Stored?
- In the
__pycache__directory - Filenames include the Python version, e.g.,
module.cpython-39.pyc
Should You Commit Them?
No, .pyc files are auto-generated. Add __pycache__/ to .gitignore.
Wrap-Up
__pycache__ improves performance but should not be committed to version control.