do design patterns still apply with Python?

Paul Rubin http
Fri Mar 3 01:29:48 CET 2006


John Salerno <johnjsal at NOSPAMgmail.com> writes:
> Since Python does so many things different, especially compared to
> compiled and statically typed languages, do most of the basic design
> patterns still apply when writing Python code? If I were to read a
> design pattern book (such as Head First Design Patterns), could I
> apply their Java examples to Python easily enough, or does Python
> require a different perspective when applying patterns?

I'd say the relative importance of particular patterns depends on
whether the problems it solves are easier or harder in the language
you're using.  Many things that are difficult in Java are easy in
Python, so the patterns in the book aren't terribly relevant.
Somewhat less often, something is easy in Java and difficult in
Python.  When that happens, you may need approaches that aren't in the
book.  Finally, you have to think of all of these books as different
approaches of explaining elephants to blind men.  There's a lot of
murkiness in programming and design patterns are yet another way to
help guide people through it.  But the more programming you do, the
better your own internal maps and instincts become, and the less you
need a guidebook that doesn't always correspond to the actual
landscape you're operating in.  So consider the books to contain
helpful guidelines but don't feel afraid to trust your own instincts
over them, especially after those instincts become better developed.



More information about the Python-list mailing list