[Baypiggies] The (lack of) design patterns in Python

Alex Martelli aleax at google.com
Tue Aug 4 19:51:48 CEST 2009


On Tue, Aug 4, 2009 at 9:52 AM, Tung Wai Yip<tungwaiyip at yahoo.com> wrote:
> I agree. I've pick up the Design Patterns book one time after it was sitting
> in the bookshelve for many years. I find most of them are really class based
> C++ design patterns and are irrelevant for Python. That say there must be
> some Python patterns that are useful. The decorate-sort-undecorate DSU
> pattern has come to mind.

Take a look at my presentations on Patterns in Python, there are many
around the web (videos you can find on YouTube, etc). In the past I've
deemed DSU an idiom, not a pattern -- it's not deep, doesn't imply
anything much about how you design things, it's very much about a good
implementation, that's all (I believe I introduced the term DSU about
9-10 years ago -- before then I was calling it a Schwartzian
transform, by analogy with Perl, but purists quibbled about that term
so I tried DSU instead... I'm not quite sure that I coined the term,
but researching comp.lang.python's archives I can't find mentions
earlier than mine). But, many other families of patterns are useful
and widely used -- factories, dependency injection (including
dependency injection of factories, a crucially precious mix!),
template method and its many more-flexible variants, ...


Alex


More information about the Baypiggies mailing list