PyDev of the Week: Pablo Galindo Salgado

This week we welcome Pablo Galindo Salgado (@pyblogsal) as our PyDev of the Week! Pablo is a core developer of the Python programming language. He is also a speaker at several Python related conferences. If you’d like to see what projects he is contributing to, you can check out his Github profile.

Let’s spend some time getting to know Pablo better!

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

I am currently working at Bloomberg L.P. in the Python infrastructure team, supporting all our Python developers and providing critical infrastructure and libraries to make sure everyone has better experience programming in Python. But before working on the Software industry I used to be in academia as a theoretical physicist researching general relativity and in particular, black hole physics. This is something that I still do as a hobby (although without the pressures of publication and funding) because I still love it! For instance, I have given some talks in some Python conferences related to this
(https://www.youtube.com/watch?v=p0Fc2jWVbrk) and I continue developing and researching improved algorithms to simulate and visualize different spacetimes. For example, here you have some simulated Kerr Newman black holes with accretion disks around them I have worked on recently:

Accretion Disks
and here with some textures mapped to the sky sphere and the accretion disk:
Texture mapped accretion disks

When I am not burning my CPU cores doing core dev work in CPython I burn them doing more and more simulations. I love to still work on this because it brings together two of my passions: theoretical physics and coding! Some times, to optimize your code you need a better equation instead of a better algorithm!

Why did you start using Python?

I started using Python when I started working on my PHD in order to orchestrate and glue some simulation code in C (and some times FORTRAN 77!) ) and to do data processing and analysis. I immediately fell in love with the language and later with the community and
the ecosystem (as a famous phrase “Come for the language, stay for the community”). I had been exposed to many other languages before but I started using more and more Python because it had something mesmerizing that made programming very very fun. Also, in the scientific world (and excluding the huge world of data science and machine learning) it allows for fast prototyping of ideas and integration of pre-existing systems
in a way that other people can use and extend easily and intuitively. Also, as opposed to many other scientific tools and suites: is free and open-source, which I think is fundamental for making science more transparent, available and reproducible!

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

Apart from Python, I am fluent in C and Fortran (for real!) and I am confident coding in Rust and C++. Apart from that, I can proudly say that I have code several times in some form of Javascript without making things explode and I can copy some pre-existing HTML and CSS and modify it to make some cool front ends. I coded many many years in the Wolfram Language (Mathematica) but this is something that I don’t do anymore, although sometimes I miss some of the functional patterns that it has.

Even if is not very used today and has its fair amount of logical criticism, I still love C. It may be the Stockholm syndrome talking but I find it very simple and (more often than not) elegant. I also find that i has a good level of abstraction when I need to reason about some low-level effects or I need to be “closer to the metal”. Also when I started coding in C I had a fair amount of experience with FORTRAN (a.k.a. FORTRAN77) and let me tell you something: finding for the first time that you can code without leaving the first five columns of every line empty is a life-changing experience. Another life-changing experience is when you find much later in your life that such nonsense was for compatibility with punch-cards.

What projects are you working on now?

All my open source work is mainly on CPython, but apart from my general work as a core dev, since last year I have been also working a lot in a project together with Guido van Rossum, Lysandros Nikolaou, Emily Morehouseto and others to replace the current parser in CPython for a new shiny PEG parser!

I am very passionate about parsers and formal languages (I have given several talks about them and how the one in CPython works as https://www.youtube.com/watch?v=1_23AVsiQEc&t=2018s) so this project is very exciting to explore because with it we will be able to not only eliminate several ugly hacks in the current LL(1) grammar but also it will allow writing some constructs that now are impossible. In particular, I have been fighting for a while trying to allow grouping parenthesis in context managers like

with (
    something_very_long_here as A,
   something_else_ very_long_here as B,
   more_long_lines as C,
):
   ...

but this sadly is not possible with the current parsing machinery. Believe me: I have tried every trick in the book. Also, we hope that with the new parser many pars of the existing grammar will be written in a more maintainable and readable way. Stay tuned to know more!

What other parts of Python core do you work on?

As a Python core developer, I mainly work on the Python runtime and VM, especially in the parser, the AST,the compiler and the garbage collector. But apart from those focus areas,
I have worked all around the place in the standard library: posix, multiprocessing, functools, math, builtins…. I also spend a huge amount of the time squashing bugs and race conditions and taking care of the CPython CI and the buildbot system (check out this blog post in the PSF blog about it http://pyfound.blogspot.com/2019/06/pablo-galindo-salgado-nights-watch-is.html).

Talking to some other core devs, recently I found out that I am among the 3 “most active” core developers since I was promoted (https://github.com/python/cpython/graphs/contributors?from=2018-05-07&to=2020-03-25&type=c)!

I also focus a lot on making CPython more approachable to contributors and future core devs. For instance, I have recently written a very complete design document for one of the most undocumented areas of CPython (https://devguide.python.org/garbage_collector/). I am also spending a lot of time mentoring contributors with the hope that some of them become future core devs! Mentoring is very demanding but I think is a very important part of making sure that Python stays alive and we have an open and inclusive community.

I am also very grateful for having some of the most incredible, talented and candid people around me in the core dev team as they are one of the main reasons I contribute every day!

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

This is a hard question! I will abuse the fact that the question does not set a limit of libraries to list a few:

From the standard library: gc, ast, posix (¯\_(?)_/¯), functools, tracemalloc and itertools.
3rd party: Cython and numpy.

I see you were part of the team behind PEP 570. How were you involved?

I did the full implementation, shepherded the discussion and wrote most of the PEP document in a not very impressive English, but thanks to my other co-authors and Carol Willing (who is my role model for several things, including documenting and explaining
complex things in an easy way) the document has improved massively since the first version I wrote.

Do you have a favourite obscure Python feature or module?

I love chained comparisons! For instance when you write:

if a < c < d:
   ...

instead of:

if a < c and d < d:
   ...

I also love that you can use them in a less intuitive way like:

>>> x = "'Hola'"
>>> x[-1] == x[0] in {"'", "other", "string"}
True

This feature has a slightly dark side that can confuse a lot of people, especially when written with other operators:

>>> False == False in [False]
True

Sadly, using chained comparisons is marginally slower 🙁

Is there anything else you’d like to say?

Thanks a lot for asking me to do this interview, and also thanks to everyone that has survived until the end of it 🙂

Thanks for doing the interview, Pablo!

1 thought on “PyDev of the Week: Pablo Galindo Salgado”

  1. Pingback: PyDev of the Week: Pablo Galindo Salgado - Bizidev.com

Comments are closed.