Save 37% off PRO during our Black Friday Sale! »

What in fact is this Python?

What in fact is this Python?

A brief Python history and a collection of the useful domain-specific libraries.

200442040b9d038626d92d408f499642?s=128

Serge Matveenko

March 14, 2017
Tweet

Transcript

  1. What in fact is this Python? Serge Matveenko DataArt twitter.com/lig1

  2. Python could be like this

  3. Also Python could be like this

  4. However we are talking about that Python

  5. Disclaimer: a lot of dates here

  6. Path to Python 2.0 • 1980s — ABC — “Centrum

    Wiskunde & Informatica” • December 1989 — Guido van Rossum “Centrum Wiskunde & Informatica” • February, 1991 — Python 0.9.0 • January, 1994 — Python 1.0 • 1995 — Python 1.2 • “Corporation for National Research Initiatives” • May, 2000 — Independent development • September, 2000 — Python 1.6 — last at CNRI • September, 2000 — Python 2.0 — the first modern
  7. Python 2.0 • SourceForge • PEPs • Unicode • List

    Comprehensions • Augmented Assignment `+=`, `-=` , … • String Methods `s.join(seq)` • gc module • apply(f, args, kw) → f(*args, **kwargs) • `print >> sys.stderr, "Hello"` • `zip()` • `from distutils.core import setup` • codecs, zipfile, mmap, xml.sax, xml.dom foo = [0, 2, 1] bar = [x for x in foo if x] y = 2 y += 1 print y == 2 # 0
  8. Python 2.0 → Python 2.5 • Python 2.1 - April

    17, 2001 ◦ unittest • Python 2.3 - July 29, 2003 ◦ PEP 285 -- Adding a bool type • Python 2.4 - November 30, 2004 ◦ PEP 318 -- Decorators for Functions and Methods • Python 2.5 - September 19, 2006 ◦ PEP 308 -- Conditional Expressions • Zope 2 - 1998 • Zope 3 / BlueBream - 2004 • Django - July 21, 2005
  9. Python 2.0 → Python 2.5 def bool_or_nothing(func): def wrapper(arg): if

    arg in [0, 1]: return func(arg) else: return None return wrapper def foo(arg): return not arg foo = bool_or_nothing(foo) def bool_or_nothing(func): def wrapper(arg): return ( func(arg) if isinstance(arg, bool) else None) return wrapper @bool_or_nothing def foo(arg): return not arg
  10. Zope → Django <metal:description define-slot= "content-description" > <metal:comment tal:content= "nothing">If

    you write a custom description always use <div class="documentDescription" ></div> for it</metal:comment> <div metal:use-macro= "context/kss_generic_macros/macros/generic_description_view" >Generic KSS Description. Is rendered with class="documentDescription". </div> </metal:description> {% if latest_question_list %} <ul> {% for question in latest_question_list %} <li><a href="/polls/{{ question.id }}/">{{ question.question_text }}</a></li> {% endfor %} </ul> {% else %} <p>No polls are available. </p> {% endif %}
  11. Django from django.http import HttpResponse import datetime def current_datetime(request): now

    = datetime.datetime.now() html = "<html><body>It is now %s.</body></html>" % now return HttpResponse(html) from django.conf.urls import url from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^posts/$' , views.post_list, name= 'post_list' ), ]
  12. Six - Pre-Modern Era • Python 2.6 - October 1,

    2008 ◦ PEP 343 -- The "with" Statement ◦ PEP 3129 -- Class Decorators ◦ multiprocessing • Python 3.0 - December 3, 2008 ◦ PEP 3107 -- Function Annotations ◦ PEP 3129 -- Class Decorators • Python 2.7 - July 3, 2010 ◦ More Python 3 compatibility • Python 3.2 - February 20, 2011 ◦ The first mature • Pypy - 2008 • Zope Five - 2009 • Pytest - Aug 4, 2009 • Flask - April 1, 2010 • Six - Mar 15, 2011 • Pip - April 4, 2011
  13. Python 3 — Modern Era • Python 3.3 - September

    29, 2012 ◦ PEP 380 -- Syntax for Delegating to a Subgenerator ◦ PEP 414 -- Explicit Unicode Literal for Python 3.3 • Python 3.4 - March 16, 2014 ◦ asyncio • Python 3.5 - September 13, 2015 ◦ PEP 484 -- Type Hints ◦ PEP 492 -- Coroutines with async and await syntax • Python 3.6 - December 23, 2016 ◦ PEP 526 -- Syntax for Variable Annotations ◦ PEP 525 -- Asynchronous Generators ◦ PEP 628 -- Add math.tau • Mypy - Dec 7, 2012 • Pypy3 - June 20, 2014
  14. It's a kind of magic async def ping_server(ip: str): #

    ping code here... async def ping_local(): async with connection.connect(): ip: str = await connection.get_ip() return await ping_server(ip)
  15. Why Python? • Web Development • Scientific and Numeric •

    Education • Desktop GUIs • 3D Modelling • Q&A • Automation • Embedded Systems
  16. Web development • Django • Flask • Tornado • Plone

    • aiohttp • requests • bottle • WebOb
  17. Scientific and Numeric • NumPy • SciPy • Pandas •

    Jupyter • PyOpenCL • Scikit-learn
  18. Education • Tutorials • Books • Videos • Academic papers

    • pygame • … • Raspberry Pi
  19. Desktop GUIs • PyQT • GTK • Tkinter • wxWidgets

    • Kivy (mobile apps)
  20. Automation • Ansible • SaltStack • fabric • Bash replacement

  21. Why Python? • Web Development • Scientific and Numeric •

    Education • Desktop GUIs • 3D Modelling • Q&A • Automation • Embedded Systems
  22. Thank you! Serge Matveenko DataArt twitter.com/lig1 t.me/SergeMatveenko