OO patterns with Python

Alex Martelli aleax at aleax.it
Tue Feb 11 05:21:46 EST 2003
Ryan wrote:

> I don't know about a book or a URL on patters which is
> language-independant,
> but there are two books that cover a nice bit of it for Python;
> 
> 1) Python Programming Patterns by Thomas W. Christopher
> 2) Python Cookbook by Alex Martelli (Oriely)

[snipped overlong URLs]


Far be it from me to wish to discourage purchases of the Cookbook
(which is only *edited* by me and David Ascher, and published by
O'Reilly -- the *authors* are over a hundred Pythonistas), but I
do not agree that it covers "a nice bit" of design patterns -- it
barely scratches the surface here and there.  My impression of
"Python Programming Patterns" is also that it's quite far from
Design Patterns, but I haven't looked at it in enough depth, so
it's just an impression.

> OO is more a mindset than anything, the fact that the language give
> convinient constructs to use the concepts is just a big conviniance.

To some extent, yes.  However, in another sense, "the limits of
my language are the limits of my world" (Wittgenstein) applies --
*in practice* you won't use multiple dispatch in Python (nor in
C++, Java, C#, ....) BECAUSE the language does not support it
directly -- but you might well use it in Dylan for similar problems.

This does influence what patterns are actually available to you --
and more directly, which are relevant (many patterns deal with
working around limitations due to strict typing -- in Python all
such patterns are basically irrelevant).

I suggest www.aleax.it/Python/5ep.html for some reflections on
Patterns and NON-Patterns, in a Python context.


Alex





More information about the Python-list mailing list