Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python for Java developers

Python for Java developers

D7d3f3dd5063d56c96151d433c303c1a?s=128

Javier Honduvilla Coto

November 24, 2014
Tweet

Transcript

  1. Can I haz ur pythons? Rafael Medina García @rmed_dev Fco.

    Javier Honduvilla Coto @javierhonduco
  2. Where is python?

  3. Examples for the Java weenies

  4. Simple TCP Socket: Java

  5. Simple TCP Socket: Python

  6. Reading a file: Java

  7. Reading a file: Python

  8. Hashtable: Java

  9. “Hashtable”: Python

  10. Why python rocks? • Function parameters • GC ◦ Reference

    counting • Decorators • Types (WTF) • List-Stack-Queue-[...] • PyPI
  11. Concurrency is not parallelism • Concurrency ◦ GIL: Global Interpreter

    Lock (</3) i. threads vs processes • celery ii. tasks iii. groups iv. pipes • cpython, pypy
  12. Celery • Async framework task Queue + Tasks = fun

  13. Cpython and moar • cpython ◦ Guido’s Python Interpreter •

    pypy ◦ “an implementation of the Python programming language written in Python itself”
  14. Web frameworks + wsgi • Django • Flask • ∞

  15. Scientific packages • ipython + notebook • cython • numba...

  16. Our fav libs • requests (http for humans) • SQLAlchemy

    (database toolkit)
  17. SQLAlchemy I

  18. SQLAlchemy II

  19. Is (c)python slow? • Overhead • Cache misses • Complex

    data structures • Any variable can change its type • (dynamic)
  20. None
  21. 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/