Date post: | 20-Mar-2017 |
Category: |
Data & Analytics |
Upload: | dataart |
View: | 28 times |
Download: | 0 times |
А какой на самом делеэтот Python?
Сергей МатвеенкоDataArt
twitter.com/lig1
Python может быть такой
А еще Python может быть такой
Но мы про такой Python
Предупреждение: здесь будет много дат
Path to Python 2.0● 1980-е — 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
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 = 2y += 1
print y == 2 # 0
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
Python 2.0 → Python 2.5def 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_nothingdef foo(arg): return not arg
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 %}
Django
from django.http import HttpResponseimport 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 urlfrom django.contrib import admin
urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^posts/$', views.post_list, name= 'post_list'),]
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
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
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)
Why Python?
● Web Development● Scientific and Numeric● Education● Desktop GUIs● 3D Modelling● Q&A● Automation● Embedded Systems
Web development
● Django● Flask● Tornado● Plone● aiohttp● requests● bottle● WebOb
Scientific and Numeric
● NumPy● SciPy● Pandas● Jupyter● PyOpenCL● Scikit-learn
Education
● Tutorials● Books● Videos● Academic papers● pygame● …● Raspberry Pi
Desktop GUIs
● PyQT● GTK● Tkinter● wxWidgets● Kivy (mobile apps)
Automation
● Ansible● SaltStack● fabric● Bash replacement
Why Python?
● Web Development● Scientific and Numeric● Education● Desktop GUIs● 3D Modelling● Q&A● Automation● Embedded Systems
Спасибо!
Сергей МатвеенкоDataArt
twitter.com/lig1