PyDev of the Week: Victor Stinner

This week we welcome Victor Stinner as our PyDev of the Week! Victor is quite active in the Python community and is a core Python developer. You can see some of his contributions here. He is the author of eight accepted PEPs which you can also read about at the previous link. If you’re interested in seeing what else Victor has been up to, then I highly recommend checking Github and ReadTheDocs. Victor also has put together some interesting benchmarks for CPython and about FASTCALL optimization. You might also want to check out his latest talk about Python benchmarks here: https://fosdem.org/2017/schedule/event/python_stable_benchmark/

Now let’s spend some time getting to know Victor better!

Can you tell us a little about yourself (hobbies, education, etc):

Hi, my name is Victor Stinner, I’m working for Red Hat on OpenStack, and I’m a CPython core developer since 2010.

I am an engineer from the engineer school Université de Technologie de Belfort-Montbéliard (UTBM), France. When I don’t hack CPython, I play with my two little cute daughters 🙂

What other programming languages do you know and which is your favorite?

I was always programming. I tried a wide range of programming languages from the lowest level Intel x86 assembler to high level languages like Javascript and BASIC. Even if I now really enjoy writing C code for best performances, Python fits better my requirements for my daily job. Since it’s easy to write Python code, and I’m not annoyed by memory management or analyzing crashes, I use the “free” time to write more unit tests, take care of the coding
style, and all tiny stuffs which make a software a “good software”.

After 10 years of professional programming, I can now say that I spent more time on reading “old” code and fixing old complex corner case, than writing new code from scratch. Having an extensible test suite makes me more cool. Having to work under pressure without straps is likely to lead to burnout, or more simply to quit a job.

What projects are you working on now?

At Red Hat, I have a big project of porting OpenStack to Python 3. OpenStack is made of more than 3 millions of Python code, and it is growing everyday! More than 90% of the unit tests already pass on Python 3, we are now working on fixing last issues on functional and
integration tests.

On CPython, I spent a lot of time on fixing Unicode in the childhood of Python 3. Nowadays, I’m working on multiple projects to make CPython faster. The very good news is that CPython 3.6 is now faster than 2.7 on most benchmarks, and CPython 3.7 is already faster than CPython 3.6! In short, Python 3 is finally faster than Python 2!

Last year, I spent a lot of time on a “FASTCALL” optimization which avoid the creation of a temporary tuple to pass positional arguments and a temporary dictionary to pass keyword arguments. More than 3/4 of my FASTCALL work is now merged into CPython. When a function is converted to FASTCALL, it becomes usually 20% faster, and the conversion is straightforward.

While working on FASTCALL and other optimizations, I was blocked by benchmarks which were not reliable. You can see the “How to run stable benchmarks” talk which I just gave at FOSDEM (Brussels, Belgium) which lists all my findings and explains how to get reproducible and reliable results: https://fosdem.org/2017/schedule/event/python_stable_benchmark/

See also the perf project that I created to make benchmarks more reliable. It’s a Python module to write a benchmark in two lines of code. The module provides many tools to check if a benchmark is reliable, compare two benchmarks and check if an optimization is significant, etc.

Which Python libraries are your favorite (core or 3rd party)?

In the Python standard library, I like the asyncio, argparse and datetime modules.

The datetime does one thing and does it well. It was enhanced recently to support Daylight Saving Time (DST): https://www.python.org/dev/peps/pep-0495/

The argparse module is very complete, it allows to build advanced command line interfaces. I used it in my perf module to get sub commands like “python3 -m perf timeit stmt”, “python3 -m perf show –metadata file.json”, …

The asyncio is a very nice integration of cool things: efficient event loop for network servers and Python 3 new async/await keywords. Not only asyncio has a nice API (no more callback hell!), but it also have a good implementation. For example, few event loop libraries support subprocesses, especially on Windows IOCP (the most efficient way to do asynchronous programming on Windows).

As a core developer, I care mostly on modules of the standard libraries, but in fact the best libraries maintained on PyPI! Just a few examples: pip, jinja2, django, etc. Sorry, the list is too long to fit here 🙂

Where do you see Python going as a programming language?

My hope is that Python will stop evolving, I’m talking about the language itself. During the slow transition to Python 3 which took years, I realized how much users like that Python 2.7 stopped evolving. Not having to touch their code is seen as an advantage, compared to fast-moving libraries or even programming languages.

Since packaging now runs smoothly with pip, it became easy to have external dependencies. The advantage of external code is that it can move much faster than the Python standard library which is basically only updated every two years with a major Python release.

Even if I dislike evolutions, I have to admit that the recent additions to the language are really cool: generalized unpacking, async/await keywords, f-string, allow underscores in numbers, etc.

Is there anything else you’d like to say?

When I listen to Twitter, Go, Rust, Javascript, Elm, etc. seem to be much more active than any other language.

In the meanwhile, I’m always impressed by all the work done in each Python release. Even the Python language is still evolving. Facebook decided to use Python 3.5 only to get the new async and await keywords with asyncio! Python 3.6 adds even more things: f-string (PEP 498), Syntax for Variable Annotations (PEP 526) and Underscores in Numeric Literals (PEP 515).

By the way, many people are complaining against type hintings. Some see them as “non pythonic”. Others fear that Python becomes a boring Java-like language. I also know that type hintings are already used in Python in large companies like Dropbox and Facebook, and they are very helpful for very large code bases.

The cool thing with Python is that it doesn’t enforce anything. For example, you can design a whole application without using objects. You can also ignore completely type hintings, they are fully optional. That’s a strength of Python!

Thanks so much for doing the interview!

1 thought on “PyDev of the Week: Victor Stinner”

Comments are closed.