

Overview and the Python Interpreter

Give Feedback

Learn what the Python interpreter is and how it translates the code you write into a language the computer can understand. You’ll also learn about the different implementations of Python and how the interpreter processes scripts.

00:00 Hi, I’m Darren from Real Python. In these videos, you’re going to see how to run your Python scripts.

00:06 You’ll look at the Python interpreter,

00:08 the differences between modules and scripts, how to run code interactively, how to run code from the command line, how to run code from a file manager, and how to run code from your IDE or text editor.

00:24 Let’s start out by looking at the Python interpreter. What is the Python interpreter? While the Python interpreter takes the code that you write and converts it into the language that the computer’s hardware understands, the computer doesn’t actually understand Python at the lowest level, and Python’s interpreter translates the code into a language the computer does understand—the 0s and 1s, bits and bytes that computers actually run on. This process is done every time you run a Python script, so unlike a compiled language where an executable file is made, each time you need the Python interpreter to do the work for you.

00:57 And that’s why you need Python installed on any computer you want to run a script on.

01:01 There are a number of implementations of Python. There’s CPython, the reference implementation of the Python language, which you may well have downloaded already from python.org. There’s Jython, which is written in Java. There’s PyPy, which is written in Python and can offer improved speed and memory use; IronPython, which targets Microsoft’s .NET platform; and MicroPython, which runs on microcontrollers, so it can run on small, low-cost hardware and IoT devices. But how does Python actually run a script?

01:34 First, it processes the statements of the script and checks for correct syntax, et cetera. Then it compiles the source code to bytecode—an intermediate, platform-independent version of the code that you’ve written. Next, it ships that code off for execution, and this is where the Python Virtual Machine comes into play, which actually runs the code that you’ve written at the lowest level.

bhumikalamba on Nov. 29, 2019

what is meant by Python Implementations ?

Become a Member to join the conversation.