concept design pattern in category python

appears as: design pattern, design patterns
Practices of the Python Pro

This is an excerpt from Manning's book Practices of the Python Pro.

To understand which design patterns you should learn and apply in Python, it’s important to understand the context in which many design patterns were developed and used. One significant driver for some design patterns is the language or languages from which they emerged. A number of design patterns come from Java, a statically typed language. Because of static typing, languages like Java are intentionally limited in how they can create instances of classes and so on. As a result, a number of design patterns are creational ones. Python’s dynamic typing frees it from many of these limitations, so many creational patterns simply aren’t necessary in Python.

Ultimately, as with many topics in this book, design patterns are a tool to help you get your work done. If you’re trying to use a design pattern to approach a problem, and it feels forced, it’s okay to move ahead without a specific pattern. A better pattern might jump out at you in the meantime.

The canonical reference for learning more about design patterns is Design Patterns: Elements of Reusable Object-Oriented Software.[2] The online software development community also has many discussions on the topic, often with useful case studies that can help you further understand if and when to use a particular pattern.