{"id":73,"date":"2025-04-13T23:05:29","date_gmt":"2025-04-13T21:05:29","guid":{"rendered":"https:\/\/ade-consulting.be\/?p=73"},"modified":"2025-04-13T23:05:29","modified_gmt":"2025-04-13T21:05:29","slug":"powerful-python-review","status":"publish","type":"post","link":"https:\/\/ade-consulting.be\/index.php\/2025\/04\/13\/powerful-python-review\/","title":{"rendered":"Powerful Python &#8211; review"},"content":{"rendered":"\n<p>This will be a blog post reviewing the technical book I\u2019ve read named \u2018Powerful Python\u2019. I will address the topics it discusses, why I chose it, and why I think it\u2019s a good or bad book.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Intro<\/h3>\n\n\n\n<p>Having a more experienced engineer in your team is a blessing to have. If you\u2019re unsure of a certain python best practice you can just go ask that person. Usually he will be able to guide you. he can explain why one should use concept A or avoid concept B. The engineer can provide constructive criticism to help you grow. However sometimes you don\u2019t have that more experienced person to turn to.<\/p>\n\n\n\n<p>At my current client, I\u2019m working in a team in which I\u2019m the most senior python developer. Here I don\u2019t have the luxury of a more senior team member. Even though I now have 5-ish years of experience, there are still plenty of topics on which I have questions. Are there better approaches, are their other techniques, is something a bad idea?<\/p>\n\n\n\n<p>So to stay up to date and find answers to my questions, I tend to read a lot of technical books. The last book I covered was \u2018Powerful Python\u2019 by Aaron Maxwell. It was a pleasure to read and I received a lot of valuable information from it. The books covers a lot of intermediate to advanced techniques that, when applied on a regular basis can make a big difference. Let\u2019s have a small overview of what I learned:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Logging and automated testing<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<p>These were 2 chapters of which I was already very familiar. The author dedicates about 25 pages to these two topics which are nice for people who haven\u2019t heard of these concepts yet. For me these concepts are a daily reality when developing and maintaining a Data Platform.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Comprehensions, advanced functions, exceptions, classes &amp; objects &amp; module organization<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<p>About half the book discussed features that are nice to understand well in python., but not essential in a day-to-day practice. For example is the use of comprehensions. The list comprehension is probably a concept that people get to know very easily. Copilot will suggest it as code very easily as well. Finding out that the comprehensions are not limited to lists only but also to sets, tuples and dicts widened my understanding.<\/p>\n\n\n\n<p>The book also dedicates a small section to <em>the most diabolical python anti pattern<\/em> or TMDPAP. This pattern discusses a coding habbit that programmers sometimes add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try:\n\t# dirty code that could raise an obscure error\nexcept Exception as e:\n\tpass<\/code><\/pre>\n\n\n\n<p>This bad habbit obscures the valuable information of a stacktrace and just continues with the rest of the code. It means that a mistake could be made but there will be no way to figure out where it was caused. The better solution is to either log that the error had happened with enough information to be able to retrace the issue later, or execute some code that handles this exception. A combination of both is preferred. Also using more precise exceptions are advised.<\/p>\n\n\n\n<p>I\u2019ll admit that after having read this chapter that I ran through my codebase to see if I had added this pattern by accident. Luckily I usually logged all the important information, but for 2 methods I was able to save myself from a headache down the line.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Generators and decorators<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<p>Finally, there were 2 chapters that I enjoyed because they were new to me. I had seen the use of decorators in unit testing before. But now thanks to the authors clear examples the usage and inner working has become clear to me. Generators will become my new go to method for objects that are prone for scaling. I will need to find some time to actually implement these into the codebase as an exercise. Otherwise I\u2019ll probably stay to my old habits without reaping the benefits of these new concepts.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Conclusion<\/h4>\n\n\n\n<p><em>Is the book worth it?<\/em><\/p>\n\n\n\n<p>The book costs around 70\u20ac which is a lot. The are probably better priced books out there that can teach you the same lessons. Also the internet can provide you with a lot of answers freely.<\/p>\n\n\n\n<p><em>But is it worth it?<\/em><\/p>\n\n\n\n<p>Yes, I do think reading this book will help you understand key concepts better. It will make you a greater engineer and help you deliver more value in the long run. The book addressed many key questions I had written down. While the internet is often a hot mess of outdated, contradicting messages, this book was the more senior engineer that I needed to guide me to become a greater python developer. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This will be a blog post reviewing the technical book I\u2019ve read named \u2018Powerful Python\u2019. I will address the topics it discusses, why I chose it, and why I think it\u2019s a good or bad book. Intro Having a more experienced engineer in your team is a blessing to have. If you\u2019re unsure of a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-73","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/posts\/73","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/comments?post=73"}],"version-history":[{"count":1,"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":74,"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/posts\/73\/revisions\/74"}],"wp:attachment":[{"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ade-consulting.be\/index.php\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}