Axa Assurance Maroc - Insurer Innovation Award 2024
What is Python Interpreter.pptx
1. In this Python Interpreter tutorial, you will see what a Python
interpreter is, how to invoke it, and how it works.
Moreover, we will discuss the environment and features of the
Interpreter of Python Programming Language.
2.
3. The default encoding for a Python source file is UTF-8. This is a Unicode
Standard variable-width character encoding; it can encode 1,112,064 valid
code points in Unicode using up to four 8-bit bytes.
Using this encoding, we can use characters of most languages – we can
use these in string literals, comments, and identifiers.
Since the standard library makes use of ASCII characters only, you must
declare the use of this encoding to your editor.
4.
5. Well, internally, four things happen in a REPL:
i. Lexing- The lexer breaks the line of code into tokens.
ii. Parsing- The parser uses these tokens to generate a structure, here,
an Abstract Syntax Tree, to depict the relationship between these
tokens.
iii. Compiling- The compiler turns this AST into code object(s).
iv. Interpreting- The interpreter executes each code object
6. Hence, we can say the compiler for Python generates bytecode for the
interpreter. The Python interpreter uses this with the virtual machine.
The same bytecode doesn’t always end up doing the same things. This is
another thing that makes Python dynamic.