Python: Design Patterns


Recently I’ve been looking into programming design patterns. I’ve found a couple of really good resources - including the HeadStart book - but they are not written from a Python point of view. There are a couple of Google video lectures but I haven’t found them all that helpful.

Has anyone else found helpful resources?


I like this site: But it requires thorough understanding of UML. Also a book I used a few years back was Design Patterns by Erich Gamma. Have to note though that I learned these design patterns within the context of C++ and Java.


That site looks really good.

Someone pointed me to this newish book which sounds good as well.


Thinking in Python is a really good book that can take you through the design pattern fundamentals.


I’m reviving this topic because it is something I am interested in.

I want to learn design patterns as a way to manage complexity in a growing code base. I have read chunks of Design Patterns by Gamma, Helm, Johnson, and Vlissides. However, as I was reading the book, I noticed that not all of the patterns are applicable to Python. Can anyone recommend some good resources to learn Python design patterns? I did notice a few mentioned in this thread, but they are about six years old!


This is not exactly a link to patterns - but it’s a really good thing to listen too before you go too far down that road. The ‘Patterns’ verse really goes back to Java, and while it has a lot to offer (especially for forcing people to reognze common problems) it’s also culturally intertwined with some very Java-derived ideas about code structure and design that should at the least be carefully examined.


Indeed, Gamma’s book, being the grand-daddy of all patterns books, is very recommended! When working with Python networking, databases, message queues when designing a pipeline, I found Fowler’s “Patterns of Enterprise Application Architecture” useful. It was a bit more applicable to what I was doing than Gamma.
“Game Programming Patterns” by Nystrom is also pretty good, if you want to try your hands at writing your own game in Unity, Python/PyGame or otherwise.


Not specifically in Python but still very easy to follow.