9
= Python Flavors

Python Flavors

Embed Size (px)

DESCRIPTION

Description of main Python implementations, CPyhon, Jython, IronPython, Brython, RubyPython and Pypy.

Citation preview

Page 1: Python Flavors

=PythonFlavors

Page 2: Python Flavors

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”.

Page 3: Python Flavors

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.”

Page 4: Python Flavors

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 Machine.

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 VM.

Page 5: Python Flavors

Python Flavors

Python Implementations

“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#

Brython Javascript Interpreter(V8) Javascript

RubyPython RubyVM Ruby

Page 6: Python Flavors

Python Flavors

Pypy a Python implementation that deserves attention

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 run time.

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.

Page 7: Python Flavors

Python Flavors

Conclusion

● 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 or .NET.

● Pypy could be a good solution to improve the performance of a Python application.

Page 8: Python Flavors

Python Flavors

References

● https://www.python.org/

● http://cython.org/

● http://ironpython.net/

● http://www.jython.org/

● http://rubypython.rubyforge.org/

● http://pypy.org/

● http://www.toptal.com/python/por-que-h-tantos-pythons/pt

Page 9: Python Flavors

Python Flavors

Contact me

● Email:

[email protected]

● Skype

○ geisonfgf

● Facebook

○ http://www.facebook.com/geisonfgf

● Twitter

○ http://www.twitter.com/geisonfgf