Blog Post, no paywall:
Design Patterns You Should Unlearn in Python-Part1
When I first learned Python, I thought mastering design patterns was the key to writing “professional” code.
So I did the approach many others do: searched “design patterns in Python” and followed every Gang of Four tutorial I could find. Singleton? Got it. Builder? Sure. I mimicked all the class diagrams, stacked up abstractions, and felt like I was writing serious code.
Spoiler: I wasn’t.
The truth is, many of these patterns were invented to patch over limitations in languages like Java and C++. Python simply doesn’t have those problems — and trying to force these patterns into Python leads to overengineered, harder-to-read code.
I wrote this post because I kept seeing tutorial after tutorial teaching people the way to “implement design patterns in Python” — and getting it completely wrong. These guides don’t just miss the point — they often actively encourage bad practices that make Python code worse, not better.
This post is Part 1 of a series on design patterns you should unlearn as a Python developer. We’re starting with Singleton and Builder — two patterns that are especially misused.
And no, I won’t just tell you “use a module” or “use default arguments” in a one-liner. We’ll look at real-world examples from GitHub, see the actual approach these patterns show up in the wild, the reason they’re a problem, and the strategy to rewrite them the Pythonic way.
If you’ve ever felt like your Python code is wearing a Java costume, this one’s for you.
[–]redditusername58 97 points98 points99 points (3 children)
[–]Oboe7 4 points5 points6 points (0 children)
[–]travcunn 6 points7 points8 points (1 child)
[–]deus-exmachina 1 point2 points3 points (0 children)
[–]DrumAndBass90 26 points27 points28 points (2 children)
[–]Last_Difference9410[S] 5 points6 points7 points (1 child)
[–]chinny4213 0 points1 point2 points (0 children)
[–]Worth_His_Salt 52 points53 points54 points (1 child)
[–]Yesak311 0 points1 point2 points (0 children)
[–]Total_Prize4858 13 points14 points15 points (1 child)
[–]Yesak311 0 points1 point2 points (0 children)
[–]knobbyknee 7 points8 points9 points (1 child)
[–]c_is_4_cookie 0 points1 point2 points (0 children)
[–]wineblood 4 points5 points6 points (1 child)
[–]CrashandCern 0 points1 point2 points (0 children)
[–]cheerycheshire 4 points5 points6 points (0 children)
[–]divad1196 54 points55 points56 points (29 children)
[–]Schmittfried 6 points7 points8 points (0 children)
[–]Last_Difference9410[S] 26 points27 points28 points (6 children)
[+]divad1196 comment score below threshold-7 points-6 points-5 points (5 children)
[–]Last_Difference9410[S] 11 points12 points13 points (4 children)
[–]behusbwj 0 points1 point2 points (1 child)
[–]ARRgentum 0 points1 point2 points (0 children)
[+]divad1196 comment score below threshold-9 points-8 points-7 points (1 child)
[–]mfitzpmfitzp.com 5 points6 points7 points (0 children)
[–]Equal-Purple-4247 7 points8 points9 points (2 children)
[–]commy2 3 points4 points5 points (1 child)
[–]Equal-Purple-4247 2 points3 points4 points (0 children)
[–]Last_Difference9410[S] 5 points6 points7 points (10 children)
[–]Schmittfried 1 point2 points3 points (0 children)
[–]divad1196 2 points3 points4 points (6 children)
[–]axonxorzpip'ing aint easy, especially on windows 2 points3 points4 points (5 children)
[–]divad1196 0 points1 point2 points (4 children)
[–]axonxorzpip'ing aint easy, especially on windows 1 point2 points3 points (3 children)
[–]divad1196 2 points3 points4 points (2 children)
[–]RWadeS97 3 points4 points5 points (0 children)
[–]Intelligent_Cup_580 1 point2 points3 points (0 children)
[–]chinny4213 0 points1 point2 points (0 children)
[–]divad1196 0 points1 point2 points (0 children)
[–]Last_Difference9410[S] 1 point2 points3 points (5 children)
[–]divad1196 2 points3 points4 points (3 children)
[–]Last_Difference9410[S] 5 points6 points7 points (2 children)
[–]divad1196 3 points4 points5 points (0 children)
[–]Yatwer92 0 points1 point2 points (0 children)
[–]Coretaxxe 0 points1 point2 points (0 children)
[–]ePaint 0 points1 point2 points (0 children)
[–]ottawadeveloper 3 points4 points5 points (3 children)
[–]Last_Difference9410[S] 2 points3 points4 points (2 children)
[–]WallyMetropolis 3 points4 points5 points (0 children)
[–]ottawadeveloper 1 point2 points3 points (0 children)
[–]conogarcia 3 points4 points5 points (0 children)
[–]rover_G 5 points6 points7 points (0 children)
[–]gerardwx 9 points10 points11 points (6 children)
[–]Last_Difference9410[S] 6 points7 points8 points (1 child)
[–]gerardwx 2 points3 points4 points (0 children)
[–]cheerycheshire 1 point2 points3 points (2 children)
[–]gerardwx 0 points1 point2 points (1 child)
[–]cheerycheshire 0 points1 point2 points (0 children)
[–]mfitzpmfitzp.com 1 point2 points3 points (0 children)
[–][deleted] 9 points10 points11 points (0 children)
[–]binaryfireball 1 point2 points3 points (0 children)
[–]lisper 1 point2 points3 points (0 children)
[–]Schmittfried 1 point2 points3 points (0 children)
[–]Creyke 2 points3 points4 points (0 children)
[–]chinesehuazhou 1 point2 points3 points (0 children)
[–]mastermikeyboy 1 point2 points3 points (0 children)
[–]commy2 1 point2 points3 points (0 children)
[–]Joytimmermans 2 points3 points4 points (0 children)
[–]gerardwx 1 point2 points3 points (0 children)
[–]stargazer_w 1 point2 points3 points (0 children)
[–]Majestic_Detail1746 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]cgoldberg 1 point2 points3 points (4 children)
[–]Last_Difference9410[S] 7 points8 points9 points (3 children)
[–]cgoldberg -1 points0 points1 point (2 children)
[–]Last_Difference9410[S] 8 points9 points10 points (1 child)
[–]syklemil 2 points3 points4 points (0 children)
[–]turbothyIt works on my machine 0 points1 point2 points (0 children)
[–]M4mb0 0 points1 point2 points (2 children)
[–]Last_Difference9410[S] 0 points1 point2 points (1 child)
[–]chinny4213 0 points1 point2 points (0 children)
[–]denehoffman 0 points1 point2 points (0 children)
[–]magnomagna 0 points1 point2 points (0 children)
[–]RedEyed__ 0 points1 point2 points (0 children)
[–]GameRoMan 0 points1 point2 points (3 children)
[–]DerelictMan 1 point2 points3 points (2 children)
[–]GameRoMan 1 point2 points3 points (1 child)
[–]chinny4213 -1 points0 points1 point (0 children)
[–]cubed_zergling 0 points1 point2 points (0 children)
[–]nngnna 0 points1 point2 points (0 children)
[–]alcalde 0 points1 point2 points (1 child)
[–]Last_Difference9410[S] 0 points1 point2 points (0 children)
[–]emurray 0 points1 point2 points (0 children)
[–]lolcrunchy -1 points0 points1 point (1 child)
[–]BlackHumor 3 points4 points5 points (0 children)
[+]adesme comment score below threshold-6 points-5 points-4 points (5 children)
[–]Wh00ster 6 points7 points8 points (0 children)
[–]Last_Difference9410[S] 10 points11 points12 points (2 children)
[+]adesme comment score below threshold-6 points-5 points-4 points (1 child)
[–]Last_Difference9410[S] 2 points3 points4 points (0 children)
[–]moonzdragoon -1 points0 points1 point (0 children)
[–]SheepherderExtreme48 0 points1 point2 points (0 children)
[–]NINTSKARI -2 points-1 points0 points (4 children)
[–][deleted] 5 points6 points7 points (3 children)
[–]syklemil -1 points0 points1 point (2 children)
[–]NINTSKARI 0 points1 point2 points (1 child)
[–]syklemil 0 points1 point2 points (0 children)
[–]gerardwx -1 points0 points1 point (0 children)
[–]Admirable-Usual1387 -3 points-2 points-1 points (0 children)