PeetRonics' blog

All can be true!

Mon 18 November 2019 - read time: 2 min.

What I Have Learned Today - #014

  

Black logo

Podcasts to stay up-to-date

One of my favourite work-related podcasts is PythonBytes. In each half-hour episode the hosts @mkennedy and @brianokken give you the latest Python news. A great and easy way to stay up-to-date. Oh, and you’ve got to love the jokes at the end of each episode 😆.

While listening to episode #156 this morning, I learned that one of the must-have Python modules, Black:

  • Has got a new release
  • Is probably moving out of Beta on… Black Friday 😃
  • Has an online playground

Why automatic code formatting

Black advertises itself as “The Uncompromising Code Formatter for Python”. In short, it will deal with the code formatting automatically and it adheres to the PEP8 style guide.

This means that, when applied on your project, you can concentrate on the code itself, without having to worry about the formatting and style. Automatic code formatting will ensure uniformity of your code and it will make code reviews a lot quicker and easier.

To make your life even easier, you can integrate it in a pre-commit hook.

Scepticism

When we first introduced Black in our project, we were faced with scepticism from some team members. Getting responses like: “Sure that cannot be working fine”, and “a good coder should do his/her own formatting/styling”.

But we pushed through, and luckily Black it is now widely adopted in the team. If only we would have known about the playground earlier, the adoption might have been a bit easier…

This post is part of a series of articles about “What I Have Learned Today”; acknowledging every day the thing I have learned. Feel free to read the other posts. all opinions in this article are my own and not necessarily represent the views of my employer.