Clean code in Python, second edition has been published, and here are the main highlights!
{width="400px"}
What's new from the previous edition?
The main change is that the book has been updated to [Python 3.9]{.title-ref}. The previous edition was started when [Python 3.6]{.title-ref} was new, and by the time it got published, [Python 3.7]{.title-ref} was just recently released. Since then, a lot has changed in Python and the book addresses the new features.
In particular, there's been a lot of improvements in the area of asynchronous programming. More to the point, asynchronous programming is becoming even more common on all projects, so the entire chapter 7 (originally dedicated to generators and iteration) has been revisited with a strong focus on asynchronous programming, showing how to also write more succinct code in this model.
All chapters have been revisited, and the examples updated to take advantage of the latest developments in Python. One example is the new assignment expression, introduced in [Python 3.8]{.title-ref}. This new edition shows how to take advantage of those features in order to write more compact code that's easier to read and maintain.
The tools and libraries have been upgraded as well, and more tools are introduced. For instance, important concepts like dependency injection are now supported with a library that makes things easier in Python.
What to expect from the book
You can expect a new version that follows the same pattern of presenting an introduction to the concepts being learnt, followed by examples that illustrate the idea. As always, I try to keep the examples concise as to avoid distractions, and focus on the topic at hand, whilst at the same time, make them relevant examples. This means, the code in the book represents situations that might very well happen in a real project, as opposed to made-up things like Fibonacci sequences.
The challenge here is try to make it relevant for different audiences: software developers, systems administrators, and data scientists. Even though the book focuses on software construction, the concepts (and their corresponding examples), are also relevant for data processing for example.
It's still a book with a pragmatic approach. I discuss the theory, but at the end of the day, the goal is that you're presented with something you can effectively implement in your day-to-day tasks. In this regard, the examples are clear enough that you could extrapolate from them to apply the concept for yourself in your projects.
What motivated me to write a new edition
You! Yes, the first edition got a really good reception. Thank you for your feedback and support! I'm always looking for ways to share my knowledge and teach others so they can develop their skills. I started this with my coworkers, then moved to meet-ups, and then I started speaking at conferences. I've always believed that this way I could share what I've learnt, so writing a book felt like the logical next step. But I never really got a grasp on how many people were learning from the content I produced, until I got your feedback from my first book, and that really motivated me!
In addition to that, technology changes all the time, evolves, and we (people) also improve over time. Over the past two years, since the first edition a lot has changed in Python, and I've also growth a lot (personally and professionally). I embarked into more challenging projects, and gained more experience on good software engineering practices and running projects at scale. At the same rate, Python was releasing new versions with more features. The confluence of these two things, landed me into the realization that was time for a new, improved version of the book.
I hope you enjoy this edition as much as I did writing it! :-)