Slide 1

Slide 1 text

Can I haz ur pythons? Rafael Medina García @rmed_dev Fco. Javier Honduvilla Coto @javierhonduco

Slide 2

Slide 2 text

Where is python?

Slide 3

Slide 3 text

Examples for the Java weenies

Slide 4

Slide 4 text

Simple TCP Socket: Java

Slide 5

Slide 5 text

Simple TCP Socket: Python

Slide 6

Slide 6 text

Reading a file: Java

Slide 7

Slide 7 text

Reading a file: Python

Slide 8

Slide 8 text

Hashtable: Java

Slide 9

Slide 9 text

“Hashtable”: Python

Slide 10

Slide 10 text

Why python rocks? ● Function parameters ● GC ○ Reference counting ● Decorators ● Types (WTF) ● List-Stack-Queue-[...] ● PyPI

Slide 11

Slide 11 text

Concurrency is not parallelism ● Concurrency ○ GIL: Global Interpreter Lock (3) i. threads vs processes ● celery ii. tasks iii. groups iv. pipes ● cpython, pypy

Slide 12

Slide 12 text

Celery ● Async framework task Queue + Tasks = fun

Slide 13

Slide 13 text

Cpython and moar ● cpython ○ Guido’s Python Interpreter ● pypy ○ “an implementation of the Python programming language written in Python itself”

Slide 14

Slide 14 text

Web frameworks + wsgi ● Django ● Flask ● ∞

Slide 15

Slide 15 text

Scientific packages ● ipython + notebook ● cython ● numba...

Slide 16

Slide 16 text

Our fav libs ● requests (http for humans) ● SQLAlchemy (database toolkit)

Slide 17

Slide 17 text

SQLAlchemy I

Slide 18

Slide 18 text

SQLAlchemy II

Slide 19

Slide 19 text

Is (c)python slow? ● Overhead ● Cache misses ● Complex data structures ● Any variable can change its type ● (dynamic)

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Bibliography ● https://jakevdp.github.io/blog/2014/05/09/why-python-is- slow/ ● http://docs.python-requests.org/en/latest/ ● https://bitbucket.org/zzzeek/sqlalchemy ● http://wsgi.readthedocs.org/en/latest/ ● http://www.dabeaz.com/python/UnderstandingGIL.pdf ● https://docs.python.org/2/library/gc.html ● https://pypi.python.org/pypi ● http://pypy.org/ ● http://www.scipy.org/