Python Design Patterns

Dave Cook davecook at nowhere.net
Tue Nov 30 04:51:00 EST 2004


On 2004-11-29, Tony Ha <tony.ha at philips.com> wrote:

> I wonder, can any Python guru out there translate the Java examples in the 

Should be a good exercise, and not just for gurus ;}.

> book into Python examples, or write a similar book in Python, perhaps

I've also wished for a design patterns book aimed at Python, or at least
dynamic languages with first class functions and modules.  There's a paper
Python book with "Patterns" in the title, but it has precious little content
in it related to design patterns, at least not the GOF variety.

This web book has the word "Patterns" in it, too:

http://www.brpreiss.com/books/opus7/

But looks like it's mainly data structures.  

If you do a google search, and also search the Python Cookbook

http://aspn.activestate.com/ASPN/Python/Cookbook/

you can find examples of:

Singleton
Borg
Null
Factory
Observer (including a Publish/Subscribe recipe)
Memento
State
Decorator
Masquerading and Adaptation patterns (Alex Martelli paper)
Template (another Alex Martelli paper)
Chain of Responsibility
Proxy
Prototype

There must be good examples in actual source code out there, too.

> called "Head First Design Patterns in Python". I think, this will be a 
> great addition to Python books, and a great benefit to Python community.

I just bought this book as well.  I must have adult ADD, because I do enjoy
the Head First format, though I disdained it at first.

> P.S. I am not sure is this the right news group to post this request.

Yup, this is the place. 

Dave Cook



More information about the Python-list mailing list