Python 3 10 years later

Similar documents
Python 3000 and You. Guido van Rossum PyCon March 14, 2008

Python 3000 and You. Guido van Rossum EuroPython July 7, 2008

Guido van Rossum 9th LASER summer school, Sept. 2012

Python - a Dynamic Programming Language. Guido van Rossum May 31, 2007

The Embedded Linux Problem

faulthandler Documentation

Table of Contents EVALUATION COPY

HOW OPENSTACK MAKES PYTHON BETTER (and vice-versa)

Introduction to Python. Didzis Gosko

Programming for AmI MOTIVATIONS AND GOALS

aiounittest Documentation

Optimizations which made Python 3.6 faster than Python 3.5

Lecture 1. basic Python programs, defining functions

Welcome to Python! Ilhoe Jung. Graphics & Media Lab

Asynchronous I/O: A Case Study in Python

Linux Kernel Evolution. OpenAFS. Marc Dionne Edinburgh

Keeping Up With The Linux Kernel. Marc Dionne AFS and Kerberos Workshop Pittsburgh

10 awesome features of Python that you can't use because you refuse to upgrade to Python 3

Spring CS 170 Exercise Set 1 (Updated with Part III)

django-konfera Documentation

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.

Open World Forum 2013

Django MFA Documentation

Ensure Documentation. Release Andrey Kislyuk

django-wiki Documentation

multiprocessing HPC Python R. Todd Evans January 23, 2015

Single Source Python 2 3

Red Hat Summit 2009 Rik van Riel

The addition of improved support for asynchronous I/O in Python 3

Algorithms and Programming I. Lecture#12 Spring 2015

spacetrack Documentation

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2

Brief Contents. Acknowledgments... xv. Introduction Chapter 1: Starting Your Project Chapter 2: Modules, Libraries, and Frameworks...

Accelerating Information Technology Innovation

Python. ECE 650 Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel

How to run stable benchmarks

python-quirc Documentation

EECS 482 Introduction to Operating Systems

The State of Python. and the web. Armin Ronacher

Teaching Python: The Hard Parts. Elana Hashman Rackspace Managed Security PyCon 2016 Portland, OR

Guido van Rossum 9th LASER summer school, Sept. 2012

Crash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++


CSCA08 Winter 2018 Week 2: Variables & Functions. Marzieh Ahmadzadeh, Brian Harrington University of Toronto Scarborough

1999 Stackless Python 2004 Greenlet 2006 Eventlet 2009 Gevent 0.x (libevent) 2011 Gevent 1.0dev (libev, c-ares)

CIS192: Python Programming

Where We Are. Lexical Analysis. Syntax Analysis. IR Generation. IR Optimization. Code Generation. Machine Code. Optimization.

Think like an Elm developer

Kickstart Intro to Java Part I

Zero Install. Decentralised cross-platform package management

18-642: Code Style for Compilers

CIS192 Python Programming

Samba, Quo Vadis? Experimenting with languages the Cool Kids use. Kai Blin Samba Team. SambaXP

JS Event Loop, Promises, Async Await etc. Slava Kim

GRADUAL TYPING OF PRODUCTION APPLICATIONS ŁUKASZ LANGA

Why I still develop synchronous web in the asyncio era. April 7th, 2017 Giovanni Barillari - pycon otto - Firenze, Italy

DNS Zone Test Documentation

Python Project Example Documentation

File Checksums in Python: The Hard Way

Python in 10 (50) minutes

BRINGING HOST LIFE CYCLE AND CONTENT MANAGEMENT INTO RED HAT ENTERPRISE VIRTUALIZATION. Yaniv Kaul Director, SW engineering June 2016

A Python for Future Generations. Ronacher

xmljson Documentation

Oracle Corporation OSCON 2012

Python Input, output and variables

Accelerating Information Technology Innovation

Introduction to Python for Scientific Computing

Python Input, output and variables. Lecture 23 COMPSCI111/111G SS 2018

asphalt-py4j Release post1

CS 326: Operating Systems. Process Execution. Lecture 5

CSCE 110 Programming I

Using Type Annotations in Python. by Philippe Fremy / IDEMIA

Python Input, output and variables. Lecture 22 COMPSCI111/111G SS 2016

Python 2 and Python 3

sainsmart Documentation

CSCE 110 Programming I Basics of Python: Variables, Expressions, Input/Output

December 8, epoll: asynchronous I/O on Linux. Pierre-Marie de Rodat. Synchronous/asynch. epoll vs select and poll

#jenkinsconf. Managing jenkins with multiple components project. Jenkins User Conference Israel. Presenter Name Ohad Basan

Administrivia. HW1 due Oct 4. Lectures now being recorded. I ll post URLs when available. Discussing Readings on Monday.

Django-CSP Documentation

How async and await ended up in Python. EuroPython 2018, Edinburgh

TOOLSMITHING AN IDA BRIDGE: A TOOL BUILDING CASE STUDY. Adam Pridgen Matt Wollenweber

Beyond Blocks: Python Session #1

chatterbot-weather Documentation

Disclaimer. This talk vastly over-simplifies things. See notes for full details and resources.

The current topic: Python. Announcements. Python. Python

SE350: Operating Systems. Lecture 3: Concurrency

Cross-platform daemonization tools.

Working in Teams CS 520 Theory and Practice of Software Engineering Fall 2018

OOP and Scripting in Python

The Impact of Django. Armin Ronacher. djangocon europe 2011

C#: framework overview and in-the-small features

COURSE 11 DESIGN PATTERNS

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017

LECTURE 1. Getting Started with Python

18-642: Code Style for Compilers

Git Branching for Agile Teams

dj-libcloud Documentation

COMP1730/COMP6730 Programming for Scientists. Testing and Debugging.

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Computer Systems Engineering: Spring Quiz I Solutions

Transcription:

Python 3 10 years later FOSDEM 2018, Brussels Victor Stinner vstinner@redhat.com

Victor Stinner CPython core developer since 2010 Work on CPython and OpenStack for Red Hat Very happy user of Fedora and vim!

Autumn

Birth of Python 3000 2006: PEP 3000 Python 3000 Fix "Python warts": long vs int; new class vs old class int vs foat division Unicode mess Comparisons Relative imports

Risk management Don't break everything, only acknowledged warts Have an open community process for deciding what to change Don't reimplement the interpreter from scratch Plan end of life for Python 2

2008: Python 3.0 released

First migration plan Run 2to3 to port your whole code base at once: you're done! Drop Python 2 is a no-go, modules authors care of Python 2 users! All dependencies must be Python 3 compatible Python 2.7 was heavily used in production

Technical debt Why should I let you work on Python 3 support? For all these new cool Python 3 features! Can we use these features? Well... since we still have to support Python 2... no

Two branches in Git? Some projects were forked to add Python 3 support. Same upstream, two names: dnspython dnspython3 Community fork: PIL Pillow Upstream does not reply: MySQL-python mysqlclient

Python 2.6 and 3.2 Python 2.6 was the stable version when 3.0 was released It requires unittest2 and more backports It requires heavy usage of the six module Python 3.2 requires six.u("unicode"); u"unicode" is a syntax error

Winter

2011: an attempt at motivating package maintainers to port to python 3

Big Python 2 projects Heavy usage of bytes Twisted Incomplete Unicode support

Python 3 trolls Python 3 doesn t bring anything Python 3 introduces new Unicode issues Using bytes is simpler

Python 2.8 idea Python 2.7 is alive: let s continue the development! 2014: LWN article Debating a "transitional" Python 2.8 concerns that Python 3 would never take of Python 3 represents under 2% of package

No Python 2.8! 2011: PEP 404 ( PEP not found ;-) ) Python 2.8 Un-release Schedule 2013: 39 of top 50 projects supports Python 3 (80%) 2014: Python 2.7 end of life extended by 5 years to 2020

Spring

Problem #1 solved! How to install a dependency? How to install setuptools? 2011: pip 1.0 released 2014: Python 2.7.9 and 3.4 now come with ensurepip pip: defacto installer Linux distros with pip

New approach Stop promoting 2to3: don t remove Python 2 support Add Python 3 support New tools like modernize and sixer Incremental changes tested by a CI

Large code base For legacy code bases: frst add new tests to reduce the risk of regression Dropbox is working on mypy and typing to annotate types in their large code base

Building bridges 2012: Python 3.3 reintroduces u"unicode" 2015: Python 3.5 adds bytes % args (PEP 461) More py3k warnings added to Python 2.7 More 2.7 backports: unittest2, enum34,

Summer

2011: 9% :-( (18/200)

2018: 95% :-) (190/200)

3.6 faster than 2.7 Results normalized to Python 2.7 lower = faster

Lisa Guo and Hui Ding Keynote

Python 2.7 WONTFIX Backward compatibility prevents to fx Python 2.7 bugs: Unicode support Hash not randomized by default subprocess is not thread safe threading.rlock is not signal safe Internal clocks are not monotonic

Fixed in Python 3 3.3: time.monotonic() (PEP 418) 3.4: fle descriptors non-inheritable, fork+exec safety (PEP 446) 3.5: retry syscalls on EINTR (PEP 475) We are aware of the code breakage this is likely to cause, and doing it anyway for the good of mankind. Guido van Rossum PEP 446 approval

2.7 3.7 new modules asyncio, concurrent.futures, contextvars, dataclasses, enum, ensurepip, faulthandler, importlib, importlib.resources, ipaddress, lzma, pathlib, secrets, selectors, statistics, tkinter.ttk, tracemalloc, typing, unittest.mock, venv, zipapp 21 new modules

f-string (PEP 498) >>> name = "world"; print(f"hello {name}!") Hello world! >>> print(f"hello {name.title()}!") Hello World! >>> x = 1; y = 2; print(f"{x} + {y} = {x + y}") 1+2=3 >>> msg = f"{1+2}"; print(msg) 3

Python 3 coroutines def generator(): yield from range(5) async def coroutine(): return await async_read() async def async_generator(): yield [ async for it in async_gen()] [await func() for func in funcs()]

New Python 3 syntax def func(arg, *, kw_only=none): print(msg, file=sys.stderr, end= ) one, *tail = range(5) cmd = ['python3', *args, 'script.py'] mydict = {"key": "value", **other_dict}

New Python 3 syntax million = 1_000_000 x: int = 5 with open( ) as infp, open( ) as outfp: bytes % args matrix_multiplication = a @ b

Bury Python 2? Fedora 23 (2015), Ubuntu 17.10 (2017): no python2 in the base system python3statement.org pythonclock.org 2017: IPython 6.0 and Django 2 are Python 3 only

Python 4?

Questions?

Sources, copyrights Autumn: https://www.fickr.com/photos/visualpanic/3035384225/ Winter: https://www.fickr.com/photos/41848869@n04/8511091 946/ Spring: https://www.fickr.com/photos/kubina/448485266/ Summer: https://www.fickr.com/photos/freaky_designz/14385194 484/ Red Hat and Python are registered trademarks.