Is Python Compiled Or Interpreted Language?
Published on October 09 2023
In this tutorial, we will learn about Python compilation and interpretation. We will also understand whether is python a compiled or interpreted language in detail. This tutorial is part of Python's top 25 most commonly asked interview questions.
Note
- Interpreted or compiled is not a property of the language but a property of the implementation. (CPython, Jython, etc.)
Compilation
- converts the high-level language to machine code before execution
- Then execution happens at the next stage (two-stage process)
- faster and more efficient to execute than interpreted languages as it is already converted.
- Rebuild is required every time you make a change.
Interpreter
- Interpreters run through a program line by line, convert it to machine code, and execute each command (on the go).
- slower than compiled languages as both happen in one step.
- E.g. Python, PHP, Ruby.
Is Python Compiled or Interpreted?
- Officially - Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
- Technically, Python is compiled to bytecode and then interpreted in a virtual machine.
- compilation happens behind the scenes (CPython)
- Generally, we call as interpreted.
- Please refer to the stackover blog.
To know about it, please refer to the official documentation website - official website.
Next Tutorial
- What Is Python, Its Benefits And Features?
- What Is Pickling And Unpickling In Python?
- Memory Management In Python
- What Is The __Init__ In Python?
- Difference Between List And Tuple
- What Is The Self Keyword In Python?
- What Is The Lambda Function In Python?
- What Is A Break, Continue, And Pass Statement In Python?
- What Are The Common Built-In Data Types In Python?
- What Is The Difference Between .Py And .Pyc Files In Python?
- What Are Decorators In Python?
- What Is Slicing In Python?
- What Are Negative Indexes In Python?
- What Is List And Dictionary Comprehension In Python?
- What Is A Docstring In Python?
- What Are Python Iterators?
- What Are *Args And **Kwargs In Python And How To Use Them?
- What Is The Pythonpath Variable In Python?
- What Are Namespaces In Python?
- What Is Pep8 (Python Enhancement Proposals) In Python?
- What Is The Split(), Join(), Sub(), And Subn() Method In Python?
- What Are Modules And Packages In Python?
- What Is Scope Resolution In Python?
- Is Python Compiled Or Interpreted Language?
- What Are Generators In Python?