Summary
Keywords
Full Transcript
💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. Singletons are often criticized for introducing global state and making code harder to test—but there’s more to the story. In this video, we explore the real problems with Singletons in Python, why module-level patterns are usually better, and where Singleton’s hidden strength can actually be useful. I’ll use a simple metaclass-based Singleton, discuss thread safety, and wrap up with a practical use case you might not expect. For more design patterns, check out this playlist: https://www.youtube.com/playlist?list=PLC0nd42SBTaNf0bVJVd9e2oBV-mcUuxS0 🔥 GitHub Repository: https://git.arjan.codes/2025/singleton. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 1:54 The Problem: Global Shared State 4:36 The Classic Singleton 7:26 The Real Pythonic Singleton 9:13 Problems With Singleton in Python 12:50 Controlled Instantiation 14:59 Final Thoughts #arjancodes #softwaredesign #python
