Hello again, Python

Shadows from clouds on the slopes of a Japanese mountain in spring.

Thanks to some organizational surprises, I’m now developing web services in Python. The last time I used Python in anger was in 2016. Has anything changed?

Records. Python has records now, thanks to attrs and dataclasses. Namedtuples were too simple and and writing classes by hand for everything was too complicated. Attrs and dataclasses are just right. I didn’t get this in 2016 when attrs was new, but I get it now. Attrs has a nice overview of how it compares to the other solutions.

Type annotations. The type annotations are useful now. I’m using JetBrains PyCharms as my IDE and it the displays type information doc popus and warns about type errors. In the command-line, mypy works – and many third-party libraries actually have type annotations! Python is no Haskell – heck, it’s not even TypeScript – but this is a welcome development.

Python 2 vs. Python 3. We’re finally in the era of Python 3. I hope.

Package management. The tools have become more robust. I have so many experiences of easy_install or pip or virtualenv mysteriously breaking. Now everything seems to work. It’s still complicated but at least it works.

I’m pleasantly surprised. I still believe that Python leaves a lot to be desired, but undeniably the developer experience has improved!

Comments or questions? Send me an e-mail.