3. Python Flavors
What is Python?
“Usually CPython, the most commonly used implementation of Python
language is called Python even it is not true since Python is the
language not the implementation. It would be possible compare the
language with an interface that have the contract which could be
implemented in different ways.
Python have a lot of implementation like CPython, Jython,
IronPython and so on”.
4. Python Flavors
Is Python interpreted or compiled?
“It depends of the implementation. In the most used
implementation, CPython it is interpreted but with some parts pre-
compiled to byte code.”
5. Python Flavors
Bytecode vs Machine Code
Basically the main diference
between machine code is
performance and portability.
Machine code is faster because
runs directly in CPU while
bytecode is more portable
because runs over a Virtual
C compile the code to machine code so the
code runs directly from cpu.
JAVA compile the code to java bytecode and
runs the code in JVM(Java Virtual Machine)
Usually programmers think Python is compiled
when they see the .pyc files. The .pyc files are
the python bytecode that runs in the CPython
6. Python Flavors
“Why uses a alternative Python implementation? To be able to uses all the stuff
regarding this technology stack, for example using Jython it is possible use all the
Java stuff and libraries.”
Implementation Virtual Machine Language
CPython CPythonVM C
Jython JVM Java
IronPython CLR C#
RubyPython RubyVM Ruby
7. Python Flavors
Pypy a Python implementation that
PyPy is a Python interpreter and just-in-time
compiler. PyPy focuses on speed, efficiency and
compatibility with the original CPython interpreter.
PyPy started out as a Python interpreter written in
the Python language itself. Current PyPy versions
are translated from RPython to C code and compiled.
The PyPy JIT (short for "Just In Time") compiler is
capable of turning Python code into machine code at
Just-in-time compilation (JIT), also
known as dynamic translation, is
compilation done during execution of a
program – at run time – rather than prior
to execution. Most often this refers to
translation to machine code, which is
then executed directly, but can also
refer to translation to another format.
8. Python Flavors
Jython a Python implementation that solve
Jython is an implementation of the Python
programming language designed to run on the Java
Jython programs can import and use any Java class.
Since Jython run over the JVM it do not implement
GIT, enabling real parallelism using Threads.
Global Interpreter Lock (GIT)
Mechanism used in computer language
interpreters to synchronize the
execution of threads so that only one
thread can execute at a time.
9. Python Flavors
MicroPython a Python for microcontrollers
Micro Python is a lean and fast implementation of
the Python 3 programming language that is optimised
to run on a microcontroller.
The Micro Python board is a small electronic circuit
board that runs Micro Python on the bare metal, and
gives you a low-level Python operating system that
can be used to control all kinds of electronic
10. Python Flavors
● It is possible write wherever program using just the original Python
implementation and never have the necessity to use other implementation.
● It is possible to use the Python language in the main technology stacks like Java
● Pypy could be a good solution to improve the performance of a Python application.
● It is possible to use Python in IoT projects.