PyDev of the Week: Lukasz Langa

This week we welcome Łukasz Langa (@llanga) as our PyDev of the Week! Łukasz is the author of PEP 443 — Single-dispatch generic functions. He also authors an interesting blog, although it’s not just a programming blog. You can see what Łukasz has been up to over on Github. Let’s take a few moments to get to know him better!

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

My first name is Łukasz which is an endless source of Unicode joy. I am a committer to Python since 2010, started out as a maintainer for configparser, nowadays working on the type hinting side of things. I like analog synthesizers, bicycles, and the Fallout game series. In my free time I’m helping Facebook embrace Python 3.

Why did you start using Python?

This is a bit embarrassing. It was Autumn 2004, I was studying Computing Science at Poznan University of Technology in Poland. I had trouble with some courses I took, namely Linear Algebra. A friend showed me some scripts he wrote in Ruby and some linear algebra library to check his results when solving homework assignments. I badly needed some reassurance so I got excited about this. Sadly, for some reason Ruby refused to install on my Windows XP box at the time.

As a test was scheduled for the very next day, I started looking for alternatives. I literally typed “ruby alternative” in Google and found Python that way. This installed cleanly and I quickly found a functional linalg library replacement. I can’t remember what it was anymore, this was before NumPy was a thing! Either way, I got hooked.

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

I’ve done a lot of programming in Java back when Java 5 was the latest and greatest. It was a pretty simple language which is both a good thing (you could get up to speed pretty quickly) and a terrible thing (design patterns were a must). I liked the comprehensive documentation, I liked being able to “build once, run everywhere”. To this day I have some applications I wrote 12 years ago with some early version of NetBeans on a Windows box. I can still build them perfectly fine on the latest macOS with ant and run them with no changes. With GUI and sounds. That’s pretty neat.

There’s also C that I invested a few years of my life in but ultimately don’t use much anymore except when interfacing with Python. I tend to romanticize it a little, but when forced to actually work with it, I’m amazed at how tedious simple operations are. It really *is* a low-level language.

I’ve also done some work with JavaScript and Hack (the typed and async-aware PHP variant running on HHVM). While the latter was surprisingly pleasant to work with, I never became friends with JavaScript. I find it somewhat unfortunate it became the language of the Web now. As for other languages, I haven’t done anything more than tutorials with Go and Swift but I did enjoy the latter quite a bit. I think I’ll be working with it more in the future.

What projects are you working on now?

As part of my day job, I’m introducing type annotations to several large codebases. It’s pretty early but we’re making good progress. This enables me to contribute back to Python, too. These days I spend most time maintaining typeshed, our collection of external type annotations for the standard library and third-party libraries.

Since I’m also taking care of Python code linting at work, I semi-regularly fix things in pyflakes, flake8, and friends. I maintain two flake8 plugins myself (flake8-bugbear and flake8-pyi), you should use them 😉

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

I like how asyncio is bringing async to the masses. It’s getting a lot of traction, and rightfully so! If you have the opportunity, try it out, it’s amazing. With the native async/await syntax and numerous improvements it received in the 3.5.x releases, it’s a joy to program in. Maybe it’s the Eastern European genes in me but I find asyncio fits my brain very well.

Speaking of the standard library, pathlib is quickly becoming one of my favorite Python libraries. It’s very elegant. I also cannot recommend mypy enough. Use it, it will make you design your APIs better, make your intent clearer to the reader, and will find bugs in the process.

Where do you see Python going as a programming language?

For a while there, I was pretty concerned with the state of Python because of the Python 2 vs. Python 3 split. Fortunately, it looks like we reached critical mass now. At work, over 16% of our Python projects are currently running on Python 3.5+ already. In the wild, we see all major dependencies supporting Python 3 now. The situation is steadily improving. I think in 2017 we will start seeing projects dropping support for Python 2 altogether. The recent release of Python 3.6 cements that, it’s the best version of Python yet and many library maintainers are eager to use it.

With the 2 vs. 3 problem out of the way, we can finally restart the conversation about what Python really is and where it should go. Historically we’ve seen it being used despite its performance, which was always pretty limited by being interpreted and by the Global Interpreter Lock. Big projects got done in Python despite its loose approach to type safety, encapsulation, and meta-programming so advanced it’s sometimes indistinguishable from magic. Clearly there’s some other reason why it got so popular.

In my view, the killer feature of Python is the high level at which it enables you to program. Some people go as far as calling it “runnable pseudocode”. I think this is a unique advantage of Python and we should double down on it. There’s voices we should rather focus on the areas where Python is “lacking”. Most of the time this means “performance”, either better multicore CPU usage or more efficient bytecode. Sometimes it means “suitability for enterprise software”, which is really asking for easier ways to find bugs before hitting production. I say we should look at those issues by the lens of further empowering people to enjoy the most high-level language out there.

In this sense, I hope for Python to reach new levels of expressiveness. Specifically, for asyncio to grow to become the default choice for efficient single- and multi-core processing. And for type annotations to start a renaissance of static analysis tools for Python, enabling programmers to enjoy friendly syntax while providing increasingly powerful testing and validation.

What is your take on the current market for Python programmers?

I find the Python community very empathetic about diversity issues and I hope this will have long-term positive impact in the workplace as well. I see the situation slowly becoming better in that regard. In terms of language popularity, looks like Python is only getting more popular, probably thanks to the new machine learning and AI frameworks.

Is there anything else you’d like to say?

Globally speaking, 2016 turned out to be a pretty nasty year. Let’s make sure 2017 turns out better!

Thanks for doing the interview!