Introduction One cool object-oriented programming (OOP) technique / pattern is enforcing consistent interfaces. In Python you can use Abstract Base Classes (ABCs) for that. 🐍 Using ABCs ensures that all subclasses implement the required methods. This can make it easier to maintain and extend the existing code base. Update Feb 2024: you can also leverage… Continue reading Elevate Your Python: Harnessing the Power of Abstract Base Classes (ABCs)
Articles on classes
Exploring the Role of Static Methods in Python: A Functional Perspective
By Bob Belderbos on 24 January 2024
Introduction Python’s versatility in supporting different programming paradigms, including procedural, object-oriented, and functional programming, opens up a rich landscape for software design and development. Among these paradigms, the use of static methods in Python, particularly in an object-oriented context, has been a topic of debate. This article delves into the role and implications of static… Continue reading Exploring the Role of Static Methods in Python: A Functional Perspective
Write more maintainable Python code, avoid these 15 code smells
By PyBites Team on 15 September 2023
This week we talk about code smells. 💡 Listen here: Also available on our YouTube channel: Code smells are characteristics in the code that might indicate deeper issues or potential problems. While they’re not necessarily bugs, they can be a sign of poor code quality or maintainability issues. 😱 We distilled 15 common smells ranging… Continue reading Write more maintainable Python code, avoid these 15 code smells
⚠️Why you should avoid import * in Python 🐍
By Bob Belderbos on 15 August 2023
Anyone who’s worked with Python knows that modules can be a Godsend, saving you time, effort, and many lines of code. They even have namespacing built-in 💪 😍 To expand on this a bit: However, not all ways of using modules are equally beneficial. In this article, we will discuss why using import * can… Continue reading ⚠️Why you should avoid import * in Python 🐍
Help, I need to refactor a mega class! Here are 5 tips …
By PyBites Team on 24 September 2022
Somebody asked the other day for tips on how to refactor a mega-class? It was actually one of the first tasks on the new job, ouch! A single class, several thousands lines of code, no tests available 😮 You might scratch your head and say WTF?! After all, good developers decouple code into manageable pieces… Continue reading Help, I need to refactor a mega class! Here are 5 tips …
Naughts and Crosses Gets a Little Help
By Geoff Riley on 12 March 2021
Naughts and Crosses (Tic-Tac-Toe to some audiences) is a popular skill game often played by children. It can also be usefully employed to distract dial up computers, at NORAD for example, rather than allowing the ‘playing’ of Global Thermonuclear War. Would you like to play a game?
How to Deploy Your Open Source Package to PyPI
By Bob Belderbos on 31 August 2020
In this post I share some useful things I learned deploying an open source package to PyPI.
When to Write Classes in Python And Why it Matters
By Bob Belderbos on 25 April 2020
When people come to Python one of the things they struggle with is OOP (Object Oriented Programming). Not so much the syntax of classes, but more when and when not to use them. If that’s you, read on. In this article I will give you some insights that will get you clarity on this.
Refactoring Opportunities That Will Boost the Quality of Your Code
By Bob Belderbos on 19 April 2020
Refactoring is all about making your code more maintainable. In this article I will provide you with Python and generic software tips to write better code.
Twitter Digest 2017 Week 49
By PyBites Team on 10 December 2017
Every weekend we share a curated list of 15 cool things (mostly Python) that we found / tweeted throughout the week.